Class: TimeBoots::WeekBoot

Inherits:
SimpleBoot show all
Defined in:
lib/time_boots/boot/week.rb

Constant Summary

Constants included from TimeBoots

VERSION

Instance Attribute Summary

Attributes inherited from Boot

#step

Instance Method Summary collapse

Methods inherited from SimpleBoot

#measure

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

#initializeWeekBoot

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