Class: ObjectPool::Method
Defined Under Namespace
Classes: Error, TerminatedError
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#callback ⇒ Object
readonly
Returns the value of attribute callback.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
- #async(&block) ⇒ Object (also: #asynchronous)
- #complete!(*opts) ⇒ Object
- #complete? ⇒ Boolean
-
#initialize(method, args, block, mx, cv, queue) ⇒ Method
constructor
A new instance of Method.
- #sync ⇒ Object (also: #synchronous)
Constructor Details
#initialize(method, args, block, mx, cv, queue) ⇒ Method
Returns a new instance of Method.
100 101 102 103 104 105 |
# File 'lib/objectpool.rb', line 100 def initialize(method, args, block, mx, cv, queue) @method, @args, @block = method, args, block @mx, @cv, @queue = mx, cv, queue @complete = false @result = nil end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
98 99 100 |
# File 'lib/objectpool.rb', line 98 def args @args end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
98 99 100 |
# File 'lib/objectpool.rb', line 98 def block @block end |
#callback ⇒ Object (readonly)
Returns the value of attribute callback.
98 99 100 |
# File 'lib/objectpool.rb', line 98 def callback @callback end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
98 99 100 |
# File 'lib/objectpool.rb', line 98 def method @method end |
Instance Method Details
#async(&block) ⇒ Object Also known as: asynchronous
116 117 118 |
# File 'lib/objectpool.rb', line 116 def async(&block) call_at_pool(false, &block) end |
#complete!(*opts) ⇒ Object
111 112 113 114 |
# File 'lib/objectpool.rb', line 111 def complete!(*opts) @callback.call(*opts) @complete = true end |
#complete? ⇒ Boolean
107 108 109 |
# File 'lib/objectpool.rb', line 107 def complete? @complete end |
#sync ⇒ Object Also known as: synchronous
121 122 123 |
# File 'lib/objectpool.rb', line 121 def sync call_at_pool(true) end |