class Dolla::PaymentSlip::DueDate

Constants

PAYSLIP_EPOCH_YEAR
PAYSLIP_MONTH_MUTATOR
PAYSLIP_YEAR_MUTATOR

Public Class Methods

new(due_date) click to toggle source
# File lib/dolla/payment_slip/due_date.rb, line 13
def initialize due_date
  @due_date = due_date
end

Public Instance Methods

hash() click to toggle source

TODO: hack temporal

# File lib/dolla/payment_slip/due_date.rb, line 18
def hash
  h = mutate_year(year) + mutate_month(month) + mutate_day(day)
  h.to_s.rjust(4, "0")
end

Private Instance Methods

mutate_day(day) click to toggle source
# File lib/dolla/payment_slip/due_date.rb, line 33
def mutate_day day
  day - 1
end
mutate_month(month) click to toggle source
# File lib/dolla/payment_slip/due_date.rb, line 29
def mutate_month month
  ( month - 1 ) * PAYSLIP_MONTH_MUTATOR
end
mutate_year(year) click to toggle source
# File lib/dolla/payment_slip/due_date.rb, line 25
def mutate_year year
  ( year - PAYSLIP_EPOCH_YEAR ) * PAYSLIP_YEAR_MUTATOR
end