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

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

Instance Method Summary collapse

Methods included from TemplateHelper

#context, #include_template

Constructor Details

#initialize(context, load_balancer, &block) ⇒ Attributes

Returns a new instance of Attributes.



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

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



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

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



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

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