Class: Fum::Lang::Zone

Inherits:
Object
  • Object
show all
Defined in:
lib/fum/lang/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
13
14
15
16
17
18
# File 'lib/fum/lang/zone.rb', line 7

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

  if block_given?
    if block.arity == 1
      yield self
    else
      instance_eval &block
    end
  end
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/fum/lang/zone.rb', line 5

def name
  @name
end

#recordsObject

Returns the value of attribute records.



5
6
7
# File 'lib/fum/lang/zone.rb', line 5

def records
  @records
end

Instance Method Details

#cname(name, opts = {}) ⇒ Object



28
29
30
# File 'lib/fum/lang/zone.rb', line 28

def cname(name, opts = {})
  @records << { :name => name, :type => 'CNAME', :target =>:env, :options => opts}
end

#elb_alias(name, opts = {}) ⇒ Object



20
21
22
# File 'lib/fum/lang/zone.rb', line 20

def elb_alias(name, opts = {})
  @records << { :name => name, :type => 'A', :target => :elb, :options => opts}
end

#elb_cname(name, opts = {}) ⇒ Object



24
25
26
# File 'lib/fum/lang/zone.rb', line 24

def elb_cname(name, opts = {})
  @records << { :name => name, :type => 'CNAME', :target =>:elb, :options => opts}
end