class DoubleEntry::Reporting::HourRange
Attributes
day[R]
hour[R]
week[R]
year[R]
Public Class Methods
from_time(time)
click to toggle source
# File lib/double_entry/reporting/hour_range.rb, line 20 def self.from_time(time) day = DayRange.from_time(time) HourRange.new :year => day.year, :week => day.week, :day => day.day, :hour => time.hour end
new(options)
click to toggle source
Calls superclass method
# File lib/double_entry/reporting/hour_range.rb, line 7 def initialize(options) super options @week = options[:week] @day = options[:day] @hour = options[:hour] day_range = DayRange.new(options) @start = day_range.start + options[:hour].hours @finish = @start.end_of_hour end
Public Instance Methods
==(other)
click to toggle source
# File lib/double_entry/reporting/hour_range.rb, line 33 def ==(other) week == other.week && year == other.year && day == other.day && hour == other.hour end
next()
click to toggle source
# File lib/double_entry/reporting/hour_range.rb, line 29 def next HourRange.from_time(@start + 1.hour) end
previous()
click to toggle source
# File lib/double_entry/reporting/hour_range.rb, line 25 def previous HourRange.from_time(@start - 1.hour) end
to_s()
click to toggle source
# File lib/double_entry/reporting/hour_range.rb, line 40 def to_s "#{start.hour}:00:00 - #{start.hour}:59:59" end