class DoubleEntry::Reporting::YearRange
Attributes
year[R]
Public Class Methods
current()
click to toggle source
# File lib/double_entry/reporting/year_range.rb, line 15 def self.current new(:year => Time.now.year) end
from_time(time)
click to toggle source
# File lib/double_entry/reporting/year_range.rb, line 19 def self.from_time(time) new(:year => time.year) end
new(options)
click to toggle source
Calls superclass method
DoubleEntry::Reporting::TimeRange::new
# File lib/double_entry/reporting/year_range.rb, line 7 def initialize(options) super options year_start = Time.local(@year, 1, 1) @start = year_start @finish = year_start.end_of_year end
Public Instance Methods
==(other)
click to toggle source
# File lib/double_entry/reporting/year_range.rb, line 23 def ==(other) year == other.year end
next()
click to toggle source
# File lib/double_entry/reporting/year_range.rb, line 31 def next YearRange.new(:year => year + 1) end
previous()
click to toggle source
# File lib/double_entry/reporting/year_range.rb, line 27 def previous YearRange.new(:year => year - 1) end
to_s()
click to toggle source
# File lib/double_entry/reporting/year_range.rb, line 35 def to_s year.to_s end