Class: Trenza::Lazy::MethodCall
- Inherits:
-
Object
- Object
- Trenza::Lazy::MethodCall
- Includes:
- BlankSlate
- Defined in:
- lib/trenza/lazy.rb
Instance Method Summary collapse
-
#initialize(&block) ⇒ MethodCall
constructor
A new instance of MethodCall.
- #method_missing(meth, *args, &blk) ⇒ Object
- #value ⇒ Object
Methods included from BlankSlate
Constructor Details
#initialize(&block) ⇒ MethodCall
Returns a new instance of MethodCall.
18 19 20 |
# File 'lib/trenza/lazy.rb', line 18 def initialize(&block) @block = block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &blk) ⇒ Object
22 23 24 |
# File 'lib/trenza/lazy.rb', line 22 def method_missing(meth, *args, &blk) value.send meth, *args, &blk end |
Instance Method Details
#value ⇒ Object
26 27 28 |
# File 'lib/trenza/lazy.rb', line 26 def value @value ||= @block.call.lazy end |