Class: Dslimple::DSL::Zone

Inherits:
Object
  • Object
show all
Defined in:
lib/dslimple/dsl/zone.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ Zone

Returns a new instance of Zone.



7
8
9
10
11
12
# File 'lib/dslimple/dsl/zone.rb', line 7

def initialize(name, &block)
  @name = name
  @records = []

  instance_eval(&block)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/dslimple/dsl/zone.rb', line 5

def name
  @name
end

#recordsObject (readonly)

Returns the value of attribute records.



5
6
7
# File 'lib/dslimple/dsl/zone.rb', line 5

def records
  @records
end

Instance Method Details

#record(name = {}, options = {}, &block) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/dslimple/dsl/zone.rb', line 14

def record(name = {}, options = {}, &block)
  if name.is_a?(Hash)
    options = options.merge(name)
    name = ''
  end
  options = options.merge(zone: @name, name: name)

  @records << Dslimple::DSL::Record.new(options, &block)
end