Class: Timer
- Inherits:
-
Object
- Object
- Timer
- Defined in:
- lib/red_query/timer.rb
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(time, &block) ⇒ Timer
constructor
A new instance of Timer.
Constructor Details
#initialize(time, &block) ⇒ Timer
Returns a new instance of Timer.
2 3 4 |
# File 'lib/red_query/timer.rb', line 2 def initialize(time, &block) @timer = `setTimeout(function () { #{block.call} }, #{time})` end |
Instance Method Details
#clear ⇒ Object
6 7 8 |
# File 'lib/red_query/timer.rb', line 6 def clear `clearTimeout(#{@timer})` end |