Module: Periods::Modules::Quarter::InstanceMethods

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

Instance Method Summary collapse

Instance Method Details

#end_yearObject



42
43
44
# File 'lib/periods/modules/quarter.rb', line 42

def end_year
  end_date.year
end

#initialize(date) ⇒ Object



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

def initialize(date)
  date = Date.parse(date.to_s)
  @start_date = beginning_of_month(date)
  @end_date   = end_of_month(@start_date.next_month(2))
end

#monthsObject



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

def months
  [ Periods::Month.for(start_date),
    Periods::Month.for(start_date.next_month),
    Periods::Month.for(start_date.next_month(2)) ]
end

#start_yearObject



38
39
40
# File 'lib/periods/modules/quarter.rb', line 38

def start_year
  start_date.year
end