module Periods::Modules::Month::InstanceMethods

Public Instance Methods

month() click to toggle source
# File lib/periods/modules/month.rb, line 17
def month
  start_date.month
end
Also aliased as: number
number()
Alias for: month
to_s(*args) click to toggle source
Calls superclass method
# File lib/periods/modules/month.rb, line 27
def to_s(*args)
  if args.first.to_s == 'month'
    "#{start_date.strftime("%m.%Y")}"
  else
    super
  end
end
year() click to toggle source
# File lib/periods/modules/month.rb, line 23
def year
  start_date.year
end

Private Instance Methods

beginning_of_month(date) click to toggle source
# File lib/periods/modules/month.rb, line 41
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/month.rb, line 45
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/month.rb, line 37
def init_with_date(date)
  init_with_dates(beginning_of_month(date), end_of_month(date))
end