Class: CloudFormatter::ResourceDescriptor

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

Instance Method Summary collapse

Constructor Details

#initialize(template, type, &block) ⇒ ResourceDescriptor

Returns a new instance of ResourceDescriptor


3
4
5
6
7
# File 'lib/cloud_formatter/resource_descriptor.rb', line 3

def initialize(template, type, &block)
  @template = template
  @type     = type
  @factory  = block
end

Instance Method Details

#create(params) ⇒ Object


9
10
11
12
13
14
# File 'lib/cloud_formatter/resource_descriptor.rb', line 9

def create(params)
  instance = Instance.new(@template)
  (class << instance ; self ; end).__send__(:define_method, :hydrate, &@factory)
  instance.hydrate(*params)
  instance
end