Class: CloudBuilder::Brick

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
ExposesRefs
Defined in:
lib/cloud_builder/brick.rb

Instance Method Summary collapse

Methods included from ExposesRefs

#base64, #get_att, #join, #ref

Constructor Details

#initialize(stack, type, hash, &block) ⇒ Brick

Returns a new instance of Brick.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cloud_builder/brick.rb', line 8

def initialize(stack, type, hash, &block)
  @stack = stack
  @type     = type
  @factory  = block
  @block = block

  @hash = DSLOpenStruct.new(hash)
  
  filename = "%s/bricks/%s.rb" % [ @stack.dirname, @type.to_s ]
  instance_eval File.read(filename), filename
end

Instance Method Details

#brickObject



20
21
22
# File 'lib/cloud_builder/brick.rb', line 20

def brick 
  @hash
end

#globalsObject



24
25
26
# File 'lib/cloud_builder/brick.rb', line 24

def globals
  @stack.globals
end

#include_brick(name, hash = {}, &block) ⇒ Object



28
29
30
# File 'lib/cloud_builder/brick.rb', line 28

def include_brick(name, hash={}, &block)
  @stack.include_brick(name, hash, &block)
end

#mappings(&block) ⇒ Object



32
33
34
# File 'lib/cloud_builder/brick.rb', line 32

def mappings(&block)
  @stack.mappings(&block)      
end

#parameter(name, &block) ⇒ Object



36
37
38
# File 'lib/cloud_builder/brick.rb', line 36

def parameter(name, &block)
  @stack.parameter(name, &block)
end

#resource(name, &block) ⇒ Object



40
41
42
# File 'lib/cloud_builder/brick.rb', line 40

def resource(name, &block)
  @stack.resource(name, &block)
end