Class: TimeBoots::WeekBoot
- Inherits:
-
SimpleBoot
- Object
- Boot
- SimpleBoot
- TimeBoots::WeekBoot
- Defined in:
- lib/time_boots/boot/week.rb
Constant Summary
Constants included from TimeBoots
Instance Attribute Summary
Attributes inherited from Boot
Instance Method Summary collapse
- #floor(tm) ⇒ Object
-
#initialize ⇒ WeekBoot
constructor
A new instance of WeekBoot.
- #to_seconds(sz = 1) ⇒ Object
Methods inherited from SimpleBoot
Methods inherited from Boot
#advance, #ceil, #decrease, get, #jump, #lace, #measure, #measure_rem, #range, #range_back, #round, #round?, steps
Methods included from TimeBoots
#advance, #ceil, #day, #decrease, #hour, #jump, #lace, #measure, #min, #month, #range, #range_back, #round, #round?, #sec, #steps, #week, #year
Constructor Details
#initialize ⇒ WeekBoot
Returns a new instance of WeekBoot.
4 5 6 |
# File 'lib/time_boots/boot/week.rb', line 4 def initialize super(:week) end |
Instance Method Details
#floor(tm) ⇒ Object
8 9 10 11 12 |
# File 'lib/time_boots/boot/week.rb', line 8 def floor(tm) f = day.floor(tm) extra_days = tm.wday == 0 ? 6 : tm.wday - 1 day.decrease(f, extra_days) end |
#to_seconds(sz = 1) ⇒ Object
14 15 16 |
# File 'lib/time_boots/boot/week.rb', line 14 def to_seconds(sz = 1) day.to_seconds(sz * 7) end |