Class: Wakame::Scheduler::UnitTimeSequence

Inherits:
TimedSequence show all
Defined in:
lib/wakame/scheduler.rb

Instance Attribute Summary

Attributes inherited from TimedSequence

#start_at

Instance Method Summary collapse

Methods inherited from TimedSequence

#[]=, #first_event, #initialize, #last_event, #next_event, #range_check?, #value_at

Constructor Details

This class inherits a constructor from Wakame::Scheduler::TimedSequence

Instance Method Details

#durationObject

Raises:

  • (NotImplementedError)


185
186
187
# File 'lib/wakame/scheduler.rb', line 185

def duration
  raise NotImplementedError
end

#set(offset_time, value) ⇒ Object



173
174
175
176
177
178
179
180
181
182
183
# File 'lib/wakame/scheduler.rb', line 173

def set(offset_time, value)
  offset_time = case offset_time
                when String
                  t=Time.parse(offset_time)
                  t.tv_sec % duration
                else
                  offset_time
                end
  super(offset_time, value) if offset_time < duration
  self
end

#start_at=(time) ⇒ Object

Snap to the begging of the period



167
168
169
# File 'lib/wakame/scheduler.rb', line 167

def start_at=(time)
  @start_at = Time.at(time.tv_sec - (time.tv_sec % duration))
end