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.
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
#config ⇒ Object (readonly)
Returns the value of attribute config.
24 25 26 |
# File 'lib/dynflow/config.rb', line 24 def config @config end |
#world ⇒ Object (readonly)
Returns the value of attribute world.
24 25 26 |
# File 'lib/dynflow/config.rb', line 24 def world @world end |
Instance Method Details
#queues ⇒ Object
36 37 38 |
# File 'lib/dynflow/config.rb', line 36 def queues @queues ||= @config.queues.finalized_config(self) end |
#validate ⇒ Object
32 33 34 |
# File 'lib/dynflow/config.rb', line 32 def validate @config.validate(self) end |