Class: Houston::Timer
- Inherits:
-
Object
- Object
- Houston::Timer
- Defined in:
- lib/houston/boot/timer.rb
Instance Method Summary collapse
- #every(interval, &block) ⇒ Object
-
#initialize ⇒ Timer
constructor
A new instance of Timer.
Constructor Details
Instance Method Details
#every(interval, &block) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/houston/boot/timer.rb', line 42 def every(interval, &block) return schedule_later :every, interval, block unless $scheduler match = Attentive::Matcher.match!(TRIGGER_PHRASE, interval) raise ArgumentError, "Unrecognized interval: #{interval.inspect}" unless match method_name, argument = match["houston.trigger.every"] $scheduler.public_send method_name, argument, &block end |