Class: ObjectPool::Method

Inherits:
Object show all
Defined in:
lib/objectpool.rb

Defined Under Namespace

Classes: Error, TerminatedError

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#argsObject (readonly)

Returns the value of attribute args.



98
99
100
# File 'lib/objectpool.rb', line 98

def args
  @args
end

#blockObject (readonly)

Returns the value of attribute block.



98
99
100
# File 'lib/objectpool.rb', line 98

def block
  @block
end

#callbackObject (readonly)

Returns the value of attribute callback.



98
99
100
# File 'lib/objectpool.rb', line 98

def callback
  @callback
end

#methodObject (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

Returns:

  • (Boolean)


107
108
109
# File 'lib/objectpool.rb', line 107

def complete?
  @complete
end

#syncObject Also known as: synchronous



121
122
123
# File 'lib/objectpool.rb', line 121

def sync
  call_at_pool(true)
end