Often, the local config is used in several parts of an application. For example:
NY_OFFICE_CONFIG = {
holidays: ['2017-07-04'],
end_of_working_day: '17:00'
}.freeze
ABU_DHABI_OFFICE_CONFIG = {
holidays: ['2017-08-08'],
work_week: %w(sun mon tue wed thu)
}.freeze
BusinessDays::Config.with(NY_OFFICE_CONFIG) { 3.business_hours.from_now }
BusinessDays::Config.with(ABU_DHABI_OFFICE_CONFIG) { 4.business_days.ago }
Clearly, continually creating and destroying the local configs could be avoided, if the generated configs were cached. If the same frozen object is passed again, one could reuse the previous local config.
I can do that if you are interested.
Often, the local config is used in several parts of an application. For example:
Clearly, continually creating and destroying the local configs could be avoided, if the generated configs were cached. If the same frozen object is passed again, one could reuse the previous local config.
I can do that if you are interested.