module Periods::Modules::Year::InstanceMethods
Public Instance Methods
days()
click to toggle source
# File lib/periods/modules/year.rb, line 30 def days (self.next.start_date - start_date).to_i end
halfyears()
click to toggle source
# File lib/periods/modules/year.rb, line 50 def halfyears [Periods::Halfyear.for(start_date), Periods::Halfyear.for(start_date.next_month(6))] end
months()
click to toggle source
# File lib/periods/modules/year.rb, line 34 def months months = [Periods::Month.for(start_date)] 1.upto(11) do |idx| months << Periods::Month.for(start_date.next_month(idx)) end months end
next()
click to toggle source
01.06.2015 => 01.06.2016
# File lib/periods/modules/year.rb, line 19 def next self.class.for(start_date.next_year) end
previous()
click to toggle source
01.06.2015 => 01.06.2014
# File lib/periods/modules/year.rb, line 26 def previous self.class.for(start_date.prev_year) end
quarters()
click to toggle source
# File lib/periods/modules/year.rb, line 42 def quarters quarters = [Periods::Quarter.for(start_date)] 1.upto(3) do |idx| quarters << Periods::Quarter.for(start_date.next_month(idx*3)) end quarters end
Private Instance Methods
beginning_of_month(date)
click to toggle source
# File lib/periods/modules/year.rb, line 60 def beginning_of_month(date) Periods::DateCalculator.new(date).beginning_of_month end
end_of_month(date)
click to toggle source
# File lib/periods/modules/year.rb, line 64 def end_of_month(date) Periods::DateCalculator.new(date).end_of_month end
init_with_date(date)
click to toggle source
# File lib/periods/modules/year.rb, line 55 def init_with_date(date) init_with_dates( beginning_of_month(date), end_of_month(beginning_of_month(date).next_year.prev_day)) end