Module: Sidetiq::Schedulable::ClassMethods

Defined in:
lib/sidetiq/schedulable.rb

Instance Method Summary collapse

Instance Method Details

#last_scheduled_occurrenceObject

Public: Returns a Float timestamp of the last scheduled run.



16
17
18
# File 'lib/sidetiq/schedulable.rb', line 16

def last_scheduled_occurrence
  get_timestamp "last"
end

#next_scheduled_occurrenceObject

Public: Returns a Float timestamp of the next scheduled run.



21
22
23
# File 'lib/sidetiq/schedulable.rb', line 21

def next_scheduled_occurrence
  get_timestamp "next"
end

#tiq(options = {}, &block) ⇒ Object

:nodoc:



25
26
27
28
29
30
31
32
# File 'lib/sidetiq/schedulable.rb', line 25

def tiq(options = {}, &block) # :nodoc:
  clock = Sidetiq::Clock.instance
  clock.synchronize do
    schedule = clock.schedule_for(self)
    schedule.instance_eval(&block)
    schedule.set_options(options)
  end
end