Class: CloudBuilder::Parameter

Inherits:
JSONable
  • Object
show all
Defined in:
lib/cloud_builder/parameter.rb

Instance Method Summary collapse

Methods inherited from JSONable

#to_json

Constructor Details

#initialize(stack, &block) ⇒ Parameter

Returns a new instance of Parameter.



3
4
5
6
7
8
9
# File 'lib/cloud_builder/parameter.rb', line 3

def initialize(stack, &block)
  @stack   = stack
  
  @Type = 'String'
  @block = block
  instance_exec(&block)
end

Instance Method Details

#brickObject



33
34
35
# File 'lib/cloud_builder/parameter.rb', line 33

def brick
  @block.binding.eval('brick')
end

#default(value) ⇒ Object



25
26
27
# File 'lib/cloud_builder/parameter.rb', line 25

def default value
  @Default = value
end

#globalsObject



17
18
19
# File 'lib/cloud_builder/parameter.rb', line 17

def globals
  @stack.globals
end

#to_hashObject



11
12
13
14
15
# File 'lib/cloud_builder/parameter.rb', line 11

def to_hash
  hash = super.to_hash
  hash.delete('block')
  hash
end

#to_json_dataObject



21
22
23
# File 'lib/cloud_builder/parameter.rb', line 21

def to_json_data
  { "Default" => @Default, "Type" => @Type }
end

#type(value) ⇒ Object



29
30
31
# File 'lib/cloud_builder/parameter.rb', line 29

def type value
  @Type = value
end