Skip to content

Instantly share code, notes, and snippets.

@Tocacar
Created June 28, 2019 14:00
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 Tocacar/6e497d31deb7ded54350c5ca3010e42c to your computer and use it in GitHub Desktop.
Save Tocacar/6e497d31deb7ded54350c5ca3010e42c to your computer and use it in GitHub Desktop.
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