Module: Charming::Controller::Timers
- Included in:
- Charming::Controller
- Defined in:
- lib/charming/controller/timers.rb
Overview
Timer control helpers mixed into Controller. Controllers are ephemeral, so starting and stopping named timers is delegated to the runtime-owned TimerControl exposed on the application (a null object outside a runtime).
Instance Method Summary collapse
-
#start_timer(name) ⇒ Object
Schedules the named declared timer.
-
#stop_timer(name) ⇒ Object
Unschedules the named timer.
-
#timer_running?(name) ⇒ Boolean
True while the named timer is scheduled.
Instance Method Details
#start_timer(name) ⇒ Object
Schedules the named declared timer. Idempotent while the timer is running.
10 11 12 |
# File 'lib/charming/controller/timers.rb', line 10 def start_timer(name) application.timer_control.start(name) end |
#stop_timer(name) ⇒ Object
Unschedules the named timer. Idempotent when it is not running.
15 16 17 |
# File 'lib/charming/controller/timers.rb', line 15 def stop_timer(name) application.timer_control.stop(name) end |
#timer_running?(name) ⇒ Boolean
True while the named timer is scheduled.
20 21 22 |
# File 'lib/charming/controller/timers.rb', line 20 def timer_running?(name) application.timer_control.running?(name) end |