Class: ConfigX::NamespaceDelegator
- Inherits:
-
Object
- Object
- ConfigX::NamespaceDelegator
- Defined in:
- lib/config_x/namespace_delegator.rb
Instance Attribute Summary collapse
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(target, namespace = []) ⇒ NamespaceDelegator
constructor
A new instance of NamespaceDelegator.
- #method_missing(*args, &block) ⇒ Object
Constructor Details
#initialize(target, namespace = []) ⇒ NamespaceDelegator
Returns a new instance of NamespaceDelegator.
3 4 5 6 |
# File 'lib/config_x/namespace_delegator.rb', line 3 def initialize(target, namespace = []) @target = target @namespace = namespace end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
10 11 12 13 |
# File 'lib/config_x/namespace_delegator.rb', line 10 def method_missing(*args, &block) method_name = args.shift target.send(config_prefixed_name(method_name), *args, &block) end |
Instance Attribute Details
#target ⇒ Object
Returns the value of attribute target.
8 9 10 |
# File 'lib/config_x/namespace_delegator.rb', line 8 def target @target end |