Class: SardonyxRing::Handlers::CronHandler
- Inherits:
-
Object
- Object
- SardonyxRing::Handlers::CronHandler
- Defined in:
- lib/sardonyx_ring/handlers/cron_handler.rb
Instance Attribute Summary collapse
-
#cron_format ⇒ Object
readonly
Returns the value of attribute cron_format.
Instance Method Summary collapse
-
#initialize(cron_format, callback) ⇒ CronHandler
constructor
A new instance of CronHandler.
- #next_time(current_time = Time.now) ⇒ Object
- #run(app) ⇒ Object
Constructor Details
#initialize(cron_format, callback) ⇒ CronHandler
Returns a new instance of CronHandler.
6 7 8 9 |
# File 'lib/sardonyx_ring/handlers/cron_handler.rb', line 6 def initialize(cron_format, callback) @cron_format = cron_format @callback = callback end |
Instance Attribute Details
#cron_format ⇒ Object (readonly)
Returns the value of attribute cron_format.
11 12 13 |
# File 'lib/sardonyx_ring/handlers/cron_handler.rb', line 11 def cron_format @cron_format end |
Instance Method Details
#next_time(current_time = Time.now) ⇒ Object
17 18 19 |
# File 'lib/sardonyx_ring/handlers/cron_handler.rb', line 17 def next_time(current_time = Time.now) cron.next(current_time) end |
#run(app) ⇒ Object
13 14 15 |
# File 'lib/sardonyx_ring/handlers/cron_handler.rb', line 13 def run(app) @callback.bind(app).call end |