Class: Veewee::Config::Definition

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Definition

Returns a new instance of Definition


13
14
15
16
# File 'lib/veewee/config/definition.rb', line 13

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

Instance Attribute Details

#componentsObject

Returns the value of attribute components


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

def components
  @components
end

#envObject (readonly)

Returns the value of attribute env


11
12
13
# File 'lib/veewee/config/definition.rb', line 11

def env
  @env
end

Instance Method Details

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

Currently not used, this is in case we will specify the a definition in the Veeweefile This is for future needs

Yields:

  • (definition_stub)

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/veewee/config/definition.rb', line 20

def define(name)
  # Depending on type, we create a variable of that type
  definition_stub=OpenStruct.new

  begin
  # Get a real definition object
  real_definition=::Veewee::Definition.new(name,env)
  rescue Error => e
    env.ui.error("Error loading provider with #{name},#{$!}",:prefix => false)
  end

  definition_stub.definition=real_definition

  env.logger.debug("config definition"){ "Start defining definition"}

  yield definition_stub

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

  components[name.to_s]=definition_stub.definition
end