Class: ThrottleQueue::FG

Inherits:
Object
  • Object
show all
Defined in:
lib/throttle-queue/single-process.rb

Overview

:nodoc: all

Instance Method Summary collapse

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

#arityObject



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

#joinObject



159
160
161
# File 'lib/throttle-queue/single-process.rb', line 159

def join
  @thread.join
end