Skip to content

Instantly share code, notes, and snippets.

Created May 13, 2016 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/f7f48779bc5ce747ae87e7b497d6bd6d to your computer and use it in GitHub Desktop.
Save anonymous/f7f48779bc5ce747ae87e7b497d6bd6d to your computer and use it in GitHub Desktop.
require 'pry'
class Collector
def initialize(db)
@db = db
end
def payments_collected_in(date)
case date
when Date.new(2016, 1, 1)
@db[:collectors].get(:payment_day) - 1
when Date.new(2016, 2, 1)
@db[:collectors].get(:payment_day) - 7
when Date.new(2016, 3, 1)
@db[:collectors].get(:payment_day) - 6
when Date.new(2016, 4, 1)
@db[:collectors].get(:payment_day) - 6
when Date.new(2016, 6, 1)
@db[:collectors].get(:payment_day) - 5
when Date.new(2016, 10, 1)
@db[:collectors].get(:payment_day) - 6
when Date.new(2016, 11, 1)
@db[:collectors].get(:payment_day) - 4
when Date.new(2016, 3, 20)
@db[:collectors].get(:payment_day) - 8
when Date.new(2016, 11, 15)
@db[:collectors].get(:payment_day) - 6
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment