Class: Trenza::Lazy::MethodCall

Inherits:
Object
  • Object
show all
Includes:
BlankSlate
Defined in:
lib/trenza/lazy.rb

Instance Method Summary collapse

Methods included from BlankSlate

included

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

#valueObject



26
27
28
# File 'lib/trenza/lazy.rb', line 26

def value
  @value ||= @block.call.lazy
end