Class: Kelbim::DSL::EC2::LoadBalancer::Attributes

Inherits:
Object
  • Object
show all
Includes:
Checker
Defined in:
lib/kelbim/dsl/attributes.rb

Instance Method Summary collapse

Constructor Details

#initialize(load_balancer, &block) ⇒ Attributes

Returns a new instance of Attributes.



11
12
13
14
15
# File 'lib/kelbim/dsl/attributes.rb', line 11

def initialize(load_balancer, &block)
  @error_identifier = "LoadBalancer `#{load_balancer}`"
  @result = {}
  instance_eval(&block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/kelbim/dsl/attributes.rb', line 22

def method_missing(method_name, *args)
  if args.length == 1
    value = args.first
    call_once(method_name)
    expected_type(value, Hash, Array)
    @result[method_name] = value
  else
    super
  end
end

Instance Method Details

#resultObject



17
18
19
20
# File 'lib/kelbim/dsl/attributes.rb', line 17

def result
  required(:cross_zone_load_balancing, @result[:cross_zone_load_balancing])
  @result
end