Class: Doing::FluentValue
- Inherits:
- BasicObject
- Defined in:
- lib/doing/fluent_value.rb
Instance Attribute Summary collapse
-
#it ⇒ Object
readonly
Returns the value of attribute it.
Instance Method Summary collapse
-
#initialize(it) ⇒ FluentValue
constructor
A new instance of FluentValue.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(it) ⇒ FluentValue
Returns a new instance of FluentValue.
5 6 7 |
# File 'lib/doing/fluent_value.rb', line 5 def initialize(it) @it = it end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/doing/fluent_value.rb', line 9 def method_missing(method, *args, &block) result = if it.respond_to?(method) it.send(method, *args, &block) else ::Kernel.send(method, *args.clone.unshift(it), &block) end FluentValue.new(result) end |
Instance Attribute Details
#it ⇒ Object (readonly)
Returns the value of attribute it.
3 4 5 |
# File 'lib/doing/fluent_value.rb', line 3 def it @it end |