Class: Everyx::Everyx
- Inherits:
-
Object
- Object
- Everyx::Everyx
- Defined in:
- lib/everyx.rb
Instance Method Summary collapse
- #add(runner, delay = 60) ⇒ Object
-
#initialize ⇒ Everyx
constructor
A new instance of Everyx.
- #join ⇒ Object
Constructor Details
#initialize ⇒ Everyx
Returns a new instance of Everyx.
4 5 6 |
# File 'lib/everyx.rb', line 4 def initialize @threads = [] end |
Instance Method Details
#add(runner, delay = 60) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/everyx.rb', line 8 def add( runner, delay = 60 ) @threads << Thread.new(runner, delay) do |r,delay| loop do r.run sleep delay end end end |
#join ⇒ Object
17 18 19 |
# File 'lib/everyx.rb', line 17 def join @threads.each {|t| t.join } end |