Class: CloudFormatter::Creator

Inherits:
Object
  • Object
show all
Defined in:
lib/cloud_formatter/creator.rb

Instance Method Summary collapse

Constructor Details

#initialize(template) ⇒ Creator

Returns a new instance of Creator


3
4
5
# File 'lib/cloud_formatter/creator.rb', line 3

def initialize(template)
  @template = template
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *params) ⇒ Object


11
12
13
14
15
16
17
18
19
# File 'lib/cloud_formatter/creator.rb', line 11

def method_missing(name, *params)
  name = name.to_s
  case @template.reference_type(name)
  when :map
    Reference::Map.new(name)
  when :resource
    @template.add_instance(name, *params)
  end
end

Instance Method Details

#ref(name) ⇒ Object


7
8
9
# File 'lib/cloud_formatter/creator.rb', line 7

def ref(name)
  Reference.new(name)
end