module WhiteHare::Monthly

Public Class Methods

beginning_of(year, month, closing_date: nil) click to toggle source
# File lib/white_hare/monthly.rb, line 13
def self.beginning_of(year, month, closing_date: nil)
  return Date.new(year, month, 1) if closing_date.nil?
  prev_month(year, month, closing_date) + 1
end
end_of(year, month, closing_date: nil) click to toggle source
# File lib/white_hare/monthly.rb, line 18
def self.end_of(year, month, closing_date: nil)
  return Date.new(year, month, closing_date) unless closing_date.nil?
  next_month(year, month, 1) - 1
end
next_month(year, month, day) click to toggle source
# File lib/white_hare/monthly.rb, line 5
def self.next_month(year, month, day)
  Date.new(year, month, day) >> 1
end
prev_month(year, month, day) click to toggle source
# File lib/white_hare/monthly.rb, line 9
def self.prev_month(year, month, day)
  Date.new(year, month, day) << 1
end
term(year, month, closing_date: nil) click to toggle source
# File lib/white_hare/monthly.rb, line 23
def self.term(year, month, closing_date: nil)
  first = beginning_of(year, month, closing_date: closing_date)
  last = end_of(year, month, closing_date: closing_date)
  first..last
end

Public Instance Methods

beginning_of_monthly(closing_date = nil) click to toggle source
# File lib/white_hare/monthly.rb, line 59
def beginning_of_monthly(closing_date = nil)
  WhiteHare::Monthly.beginning_of(year, month, closing_date: closing_date)
end
end_of_monthly(closing_date = nil) click to toggle source
# File lib/white_hare/monthly.rb, line 63
def end_of_monthly(closing_date = nil)
  WhiteHare::Monthly.end_of(year, month, closing_date: closing_date)
end
monthly_term(closing_date = nil) click to toggle source
# File lib/white_hare/monthly.rb, line 67
def monthly_term(closing_date = nil)
  WhiteHare::Monthly.term(year, month, closing_date: closing_date)
end
next_month() click to toggle source
# File lib/white_hare/monthly.rb, line 50
def next_month
  WhiteHare::Monthly.next_month(year, month, day)
end
prev_month() click to toggle source
# File lib/white_hare/monthly.rb, line 54
def prev_month
  WhiteHare::Monthly.prev_month(year, month, day)
end