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.



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

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



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

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.



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

def config
  @config
end

#worldObject (readonly)

Returns the value of attribute world.



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

def world
  @world
end

Instance Method Details

#queuesObject



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

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

#validateObject



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

def validate
  @config.validate(self)
end