module Periods::Modules::Halfyear::InstanceMethods

Public Instance Methods

months() click to toggle source
# File lib/periods/modules/halfyear.rb, line 16
def months
  months = [Periods::Month.for(start_date)]
  1.upto(5) do |idx|
    months << Periods::Month.for(start_date.next_month(idx))
  end
  months
end
quarters() click to toggle source
# File lib/periods/modules/halfyear.rb, line 24
def quarters
  [Periods::Quarter.for(start_date), Periods::Quarter.for(start_date.next_month(3))]
end

Private Instance Methods

beginning_of_month(date) click to toggle source
# File lib/periods/modules/halfyear.rb, line 34
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/halfyear.rb, line 38
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/halfyear.rb, line 29
def init_with_date(date)
  init_with_dates(
      beginning_of_month(date), end_of_month(beginning_of_month(date).next_month(6).prev_day))
end