Class: Runnable
- Inherits:
-
Object
show all
- Defined in:
- lib/s3-object-processor.rb
Instance Method Summary
collapse
Instance Method Details
#join ⇒ Object
27
28
29
|
# File 'lib/s3-object-processor.rb', line 27
def join
@thread.join if @thread
end
|
#on_finish(&callback) ⇒ Object
5
6
7
8
|
# File 'lib/s3-object-processor.rb', line 5
def on_finish(&callback)
(@on_finish ||= []) << callback
self
end
|
#run ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/s3-object-processor.rb', line 10
def run
@thread = Thread.new do
begin
yield
rescue Interrupt
ensure
begin
@on_finish.each{|on_finish| on_finish.call} if @on_finish
rescue
end
end
end
self
end
|