Module: Periods::Modules::Halfyear::InstanceMethods

Defined in:
lib/periods/modules/halfyear.rb

Instance Method Summary collapse

Instance Method Details

#initialize(date) ⇒ Object



26
27
28
29
# File 'lib/periods/modules/halfyear.rb', line 26

def initialize(date)
  date = Date.parse(date.to_s)
  super(beginning_of_month(date), end_of_month(beginning_of_month(date).next_month(6).prev_day))
end

#monthsObject



31
32
33
34
35
36
37
# File 'lib/periods/modules/halfyear.rb', line 31

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