Class: TimeBoots::YearBoot

Inherits:
Boot
  • Object
show all
Defined in:
lib/time_boots/boot/year.rb

Constant Summary

Constants included from TimeBoots

VERSION

Instance Attribute Summary

Attributes inherited from Boot

#step

Instance Method Summary collapse

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

#initializeYearBoot

Returns a new instance of YearBoot.



4
5
6
# File 'lib/time_boots/boot/year.rb', line 4

def initialize
  super(:year)
end

Instance Method Details

#measure(from, to) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/time_boots/boot/year.rb', line 8

def measure(from, to)
  if generate(from, year: to.year) < to
    to.year - from.year
  else
    to.year - from.year - 1
  end
end