Created
June 28, 2019 14:00
-
-
Save Tocacar/6e497d31deb7ded54350c5ca3010e42c 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
class WorkingDayCalculator | |
def self.working_days_from_now(number) | |
new(Date.today).add_working_days(number) | |
end | |
attr_reader :date | |
def initialize(date) | |
@date = date | |
end | |
def add_working_days(number) | |
calendar.add_business_days(date, number) | |
end | |
def calendar | |
@calendar ||= Business::Calendar.new(holidays: BankHoliday.dates) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment