Module: Kernel
- Defined in:
- lib/hyper-operation/delay_and_interval.rb
Instance Method Summary collapse
Instance Method Details
#after(time, &block) ⇒ Object
6 7 8 |
# File 'lib/hyper-operation/delay_and_interval.rb', line 6 def after(time, &block) Thread.new { sleep time; block.call } end |
#every(time, &block) ⇒ Object
2 3 4 |
# File 'lib/hyper-operation/delay_and_interval.rb', line 2 def every(time, &block) Thread.new { loop { sleep time; block.call }} end |