Class: Mccloud::Config::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/mccloud/config/definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Definition

Returns a new instance of Definition.



12
13
14
15
# File 'lib/mccloud/config/definition.rb', line 12

def initialize(config)
  @env=config.env
  @components=Hash.new
end

Instance Attribute Details

#componentsObject

Returns the value of attribute components.



9
10
11
# File 'lib/mccloud/config/definition.rb', line 9

def components
  @components
end

#envObject (readonly)

Returns the value of attribute env.



10
11
12
# File 'lib/mccloud/config/definition.rb', line 10

def env
  @env
end

Instance Method Details

#define(name) {|definition_stub| ... } ⇒ Object

Yields:

  • (definition_stub)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/mccloud/config/definition.rb', line 17

def define(name)
  # We do this for vagrant syntax
  # Depending on type, we create a variable of that type
  # f.i. component_stub.vm or component_stub.lb
  definition_stub=OpenStruct.new
  definition_stub.definition=::Mccloud::Definition.new(name,env)

  env.logger.debug("config definitions"){ "Start reading definitions"}

  yield definition_stub

  env.logger.debug("config definitions"){ "End reading definition #{definition_stub.definition.name}"}

  components[name.to_s]=definition_stub.definition
end