Class: Lapidarist::Threads

Inherits:
Object
  • Object
show all
Defined in:
lib/lapidarist/threads.rb

Instance Method Summary collapse

Constructor Details

#initializeThreads

Returns a new instance of Threads.



3
4
5
6
# File 'lib/lapidarist/threads.rb', line 3

def initialize
  @threads = []
  @abort = false
end

Instance Method Details

#<<(thread) ⇒ Object



8
9
10
# File 'lib/lapidarist/threads.rb', line 8

def <<(thread)
  @threads += Array(thread)
end

#aborting?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/lapidarist/threads.rb', line 22

def aborting?
  @abort
end

#stopObject



12
13
14
15
16
17
18
19
20
# File 'lib/lapidarist/threads.rb', line 12

def stop
  if aborting?
    kill
    exit! STATUS_ERROR
  else
    @abort = true
    abort
  end
end