Class: SardonyxRing::Handlers::CronHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/sardonyx_ring/handlers/cron_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_formatObject (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