Created
May 13, 2016 01:48
-
-
Save anonymous/f7f48779bc5ce747ae87e7b497d6bd6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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