Class: Dynflow::Config::ForWorld

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, world) ⇒ ForWorld

Returns a new instance of ForWorld.



26
27
28
29
30
# File 'lib/dynflow/config.rb', line 26

def initialize(config, world)
  @config = config
  @world  = world
  @cache  = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



40
41
42
43
44
45
46
47
# File 'lib/dynflow/config.rb', line 40

def method_missing(name)
  return @cache[name] if @cache.key?(name)
  value = @config.send(name)
  value = value.call(@world, self) if value.is_a? Proc
  validation_method = "validate_#{ name }!"
  @config.send(validation_method, value) if @config.respond_to?(validation_method)
  @cache[name] = value
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



24
25
26
# File 'lib/dynflow/config.rb', line 24

def config
  @config
end

#worldObject (readonly)

Returns the value of attribute world.



24
25
26
# File 'lib/dynflow/config.rb', line 24

def world
  @world
end

Instance Method Details

#queuesObject



36
37
38
# File 'lib/dynflow/config.rb', line 36

def queues
  @queues ||= @config.queues.finalized_config(self)
end

#validateObject



32
33
34
# File 'lib/dynflow/config.rb', line 32

def validate
  @config.validate(self)
end