Class: Wakame::Scheduler::UnitTimeSequence
- Inherits:
-
TimedSequence
- Object
- TimedSequence
- Wakame::Scheduler::UnitTimeSequence
- Defined in:
- lib/wakame/scheduler.rb
Direct Known Subclasses
PerDaySequence, PerHourSequence, PerMinuteSequence, PerWeekSequence
Instance Attribute Summary
Attributes inherited from TimedSequence
Instance Method Summary collapse
- #duration ⇒ Object
- #set(offset_time, value) ⇒ Object
-
#start_at=(time) ⇒ Object
Snap to the begging of the period.
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
#duration ⇒ Object
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 |