Class: DoubleEntry::Reporting::YearRange Private
- Defined in:
- lib/double_entry/reporting/year_range.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #year ⇒ Object readonly private
Attributes inherited from TimeRange
#day, #finish, #hour, #month, #range_type, #start, #week
Class Method Summary collapse
- .current ⇒ Object private
- .from_time(time) ⇒ Object private
Instance Method Summary collapse
- #==(other) ⇒ Object private
-
#initialize(options) ⇒ YearRange
constructor
private
A new instance of YearRange.
- #next ⇒ Object private
- #previous ⇒ Object private
- #to_s ⇒ Object private
Methods inherited from TimeRange
#human_readable_name, #include?, #key, make, range_from_time_for_period
Constructor Details
#initialize(options) ⇒ YearRange
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of YearRange.
7 8 9 10 11 12 13 |
# File 'lib/double_entry/reporting/year_range.rb', line 7 def initialize() super year_start = Time.local(@year, 1, 1) @start = year_start @finish = year_start.end_of_year end |
Instance Attribute Details
#year ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 |
# File 'lib/double_entry/reporting/year_range.rb', line 5 def year @year end |
Class Method Details
.current ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/double_entry/reporting/year_range.rb', line 15 def self.current new(:year => Time.now.year) end |
.from_time(time) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/double_entry/reporting/year_range.rb', line 19 def self.from_time(time) new(:year => time.year) end |
Instance Method Details
#==(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/double_entry/reporting/year_range.rb', line 23 def ==(other) year == other.year end |
#next ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 |
# File 'lib/double_entry/reporting/year_range.rb', line 31 def next YearRange.new(:year => year + 1) end |
#previous ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/double_entry/reporting/year_range.rb', line 27 def previous YearRange.new(:year => year - 1) end |
#to_s ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 |
# File 'lib/double_entry/reporting/year_range.rb', line 35 def to_s year.to_s end |