Class: Argo::DeferredObject

Inherits:
Delegator
  • Object
show all
Defined in:
lib/argo/deferred_object.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ DeferredObject

Returns a new instance of DeferredObject.



11
12
13
14
# File 'lib/argo/deferred_object.rb', line 11

def initialize(&block)
  @__delegator_block__ = block
  @__mutex__ = Mutex.new
end

Instance Method Details

#__getobj__Object



16
17
18
19
20
21
# File 'lib/argo/deferred_object.rb', line 16

def __getobj__
  @__mutex__.synchronize do
    @__getobj__ ||= @__delegator_block__.call
  end
  @__getobj__
end