Class: LazyObject Private
- Inherits:
-
Delegator
- Object
- Delegator
- LazyObject
- Defined in:
- Library/Homebrew/lazy_object.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
An object which lazily evaluates its inner block only once a method is called on it.
Instance Method Summary collapse
- #__getobj__ ⇒ Object private
- #__setobj__(callable) ⇒ Object private
-
#initialize(&callable) ⇒ LazyObject
constructor
private
A new instance of LazyObject.
Constructor Details
#initialize(&callable) ⇒ LazyObject
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of LazyObject.
8 9 10 |
# File 'Library/Homebrew/lazy_object.rb', line 8 def initialize(&callable) super(callable) end |
Instance Method Details
#__getobj__ ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 15 16 |
# File 'Library/Homebrew/lazy_object.rb', line 12 def __getobj__ return @__delegate__ if defined?(@__delegate__) @__delegate__ = @__callable__.call end |
#__setobj__(callable) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 |
# File 'Library/Homebrew/lazy_object.rb', line 18 def __setobj__(callable) @__callable__ = callable end |