Class: Dynflow::Config::ForWorld
- Inherits:
-
Object
- Object
- Dynflow::Config::ForWorld
- Defined in:
- lib/dynflow/config.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#world ⇒ Object
readonly
Returns the value of attribute world.
Instance Method Summary collapse
-
#initialize(config, world) ⇒ ForWorld
constructor
A new instance of ForWorld.
- #method_missing(name) ⇒ Object
- #queues ⇒ Object
- #validate ⇒ Object
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
#config ⇒ Object (readonly)
Returns the value of attribute config.
25 26 27 |
# File 'lib/dynflow/config.rb', line 25 def config @config end |
#world ⇒ Object (readonly)
Returns the value of attribute world.
25 26 27 |
# File 'lib/dynflow/config.rb', line 25 def world @world end |
Instance Method Details
#queues ⇒ Object
37 38 39 |
# File 'lib/dynflow/config.rb', line 37 def queues @queues ||= @config.queues.finalized_config(self) end |
#validate ⇒ Object
33 34 35 |
# File 'lib/dynflow/config.rb', line 33 def validate @config.validate(self) end |