Class: Rudash::ChainUtils::ChainWrapper
- Inherits:
-
Object
- Object
- Rudash::ChainUtils::ChainWrapper
- Defined in:
- lib/utils/chain_wrapper.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, ru_) ⇒ ChainWrapper
constructor
A new instance of ChainWrapper.
- #method_missing(method_name, *args, &_block) ⇒ Object
Constructor Details
#initialize(value, ru_) ⇒ ChainWrapper
Returns a new instance of ChainWrapper.
6 7 8 9 |
# File 'lib/utils/chain_wrapper.rb', line 6 def initialize(value, ru_) @value = value @ru_ = ru_ end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &_block) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/utils/chain_wrapper.rb', line 11 def method_missing(method_name, *args, &_block) result = @ru_.public_send(method_name, @value, *args) self.class.new(result, @ru_) rescue NameError raise NameError, "\"#{method_name}\" doesn't exist in Rudash" end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/utils/chain_wrapper.rb', line 4 def value @value end |