class Chef::Decorator::Lazy
Lazy
wrapper to delay construction of an object until a method is called against the object.
@example
def foo puts "allocated" "value" end a = Chef::Decorator::Lazy.new { foo } puts "started" a puts "still lazy" puts a outputs: started still lazy allocated value
@since 12.10.x
Public Class Methods
Source
# File lib/chef/decorator/lazy.rb, line 48 def initialize(&block) super @block = block end
Calls superclass method
Chef::Decorator::new
Public Instance Methods
Source
# File lib/chef/decorator/lazy.rb, line 53 def __getobj__ __setobj__(@block.call) unless defined?(@delegate_sd_obj) super end
Calls superclass method