Class: TimeBoots::SimpleBoot

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

Direct Known Subclasses

DayBoot, HourBoot, MinBoot, SecBoot, WeekBoot

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, #initialize, #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

This class inherits a constructor from TimeBoots::Boot

Instance Method Details

#measure(from, to) ⇒ Object



8
9
10
# File 'lib/time_boots/boot/simple.rb', line 8

def measure(from, to)
  ((to.to_time - from.to_time) / to_seconds).to_i
end

#to_seconds(sz = 1) ⇒ Object



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

def to_seconds(sz = 1)
  sz * MULTIPLIERS[step_idx..-1].inject(:*)
end