Class: Argo::DeferredObject
- Inherits:
-
Delegator
- Object
- Delegator
- Argo::DeferredObject
- Defined in:
- lib/argo/deferred_object.rb
Instance Method Summary collapse
- #__getobj__ ⇒ Object
-
#initialize(&block) ⇒ DeferredObject
constructor
A new instance of DeferredObject.
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 |