Class: Chef::Decorator::Lazy
- Inherits:
-
Decorator
- Object
- Decorator
- Chef::Decorator::Lazy
- Defined in:
- lib/chef/decorator/lazy.rb
Overview
Lazy wrapper to delay construction of an object until a method is called against the object.
outputs:
started
still lazy
allocated
value
Direct Known Subclasses
Instance Method Summary collapse
- #__getobj__ ⇒ Object
-
#initialize(&block) ⇒ Lazy
constructor
A new instance of Lazy.
Constructor Details
#initialize(&block) ⇒ Lazy
Returns a new instance of Lazy.
48 49 50 51 |
# File 'lib/chef/decorator/lazy.rb', line 48 def initialize(&block) super @block = block end |
Instance Method Details
#__getobj__ ⇒ Object
53 54 55 56 |
# File 'lib/chef/decorator/lazy.rb', line 53 def __getobj__ __setobj__(@block.call) unless defined?(@delegate_sd_obj) super end |