Class: TimeBoots::MonthBoot
Constant Summary
Constants included from TimeBoots
Instance Attribute Summary
Attributes inherited from Boot
Instance Method Summary collapse
-
#initialize ⇒ MonthBoot
constructor
A new instance of MonthBoot.
- #measure(from, to) ⇒ Object
Methods inherited from Boot
#advance, #ceil, #decrease, #floor, get, #jump, #lace, #measure_rem, #range, #range_back, #round, #round?, steps
Methods included from TimeBoots
#advance, #ceil, #day, #decrease, #floor, #hour, #jump, #lace, #min, #month, #range, #range_back, #round, #round?, #sec, #steps, #week, #year
Constructor Details
#initialize ⇒ MonthBoot
Returns a new instance of MonthBoot.
4 5 6 |
# File 'lib/time_boots/boot/month.rb', line 4 def initialize super(:month) end |
Instance Method Details
#measure(from, to) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/time_boots/boot/month.rb', line 8 def measure(from, to) ydiff = to.year - from.year mdiff = to.month - from.month to.day >= from.day ? (ydiff * 12 + mdiff) : (ydiff * 12 + mdiff - 1) end |