Class: ThrottleQueue::FG
- Inherits:
-
Object
- Object
- ThrottleQueue::FG
- Defined in:
- lib/throttle-queue/single-process.rb
Overview
:nodoc: all
Instance Method Summary collapse
- #arity ⇒ Object
- #call(*args) ⇒ Object
-
#initialize(block, h) ⇒ FG
constructor
A new instance of FG.
- #join ⇒ Object
Constructor Details
#initialize(block, h) ⇒ FG
Returns a new instance of FG.
144 145 146 147 148 149 150 151 |
# File 'lib/throttle-queue/single-process.rb', line 144 def initialize(block, h) @block = block @thread = Thread.new { Thread.stop unless @args @block.call *@args } @h = h end |
Instance Method Details
#arity ⇒ Object
152 153 154 |
# File 'lib/throttle-queue/single-process.rb', line 152 def arity @block.arity end |
#call(*args) ⇒ Object
155 156 157 158 |
# File 'lib/throttle-queue/single-process.rb', line 155 def call(*args) @args = args @thread.run end |
#join ⇒ Object
159 160 161 |
# File 'lib/throttle-queue/single-process.rb', line 159 def join @thread.join end |