class TimeWin::Window
Attributes
from[R]
to[R]
Public Class Methods
new(from, to)
click to toggle source
# File lib/time_win/window.rb, line 4 def initialize from, to @from, @to = from.to_time, to.to_time raise "Invalid time bounds from > to -- #{@from} > #{@to}" if !valid? end
Public Instance Methods
nb_days()
click to toggle source
# File lib/time_win/window.rb, line 25 def nb_days self.hours / 24 end
nb_hours()
click to toggle source
# File lib/time_win/window.rb, line 21 def nb_hours self.minutes / 60 end
nb_minutes()
click to toggle source
# File lib/time_win/window.rb, line 17 def nb_minutes self.seconds / 60 end
nb_seconds()
click to toggle source
# File lib/time_win/window.rb, line 13 def nb_seconds @from - @to end
shift(offset)
click to toggle source
# File lib/time_win/window.rb, line 29 def shift offset Window.new(@from+offset, @to+offset) end
to_s()
click to toggle source
# File lib/time_win/window.rb, line 33 def to_s "[#{from} --> #{@to}]" end
valid?()
click to toggle source
# File lib/time_win/window.rb, line 9 def valid? @from <= @to end