-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to load custom holidays on the fly #57
Conversation
Moves the parsing of holiday definition files into the main holidays codebase. The core logic is the same but it has been split into different methods for clarity. Some variables have also been slightly renamed for clarity. No behavior change with this commit.
Allows for the loading of custom holiday definition files on the fly. Parsed definition files are immediately loaded and can be referenced like any existing definitions.
Friendly bump! Please let me know if I need to make any modifications or if you have any suggestions. |
Thanks for the bump. I'm finally back on the job and am going to clear out all the definition updates and typos and then take a proper look at this. This gem was the project I used to learn Ruby six years ago (7268ece) so the whole definition system needs some serious evaluation. Once I've pushed out a point release with all the definition catch ups I'll be able to give this the attention it deserves. |
Any update on this? |
Sorry, I had promised to discuss it with @alexdunae after my wedding but then...forgot. I'll follow up with him and we'll make a plan on how we want to proceed. |
No worries! Belated congratulations. That’s a valid reason to forget something like that. :-)= |
Conflicts: README.rdoc rakefile.rb
Is there any chance that this PR will be merged in the near future? Thanks for the info :) |
I am trying to get in touch with @alexdunae but so far have been unsuccessful. I will merge it later this week if I don't hear back. |
I haven't heard back from @alexdunae so I'm just going to move forward. We've tentatively discussed lots of behind-the-scenes refactorings in the coming months so if he doesn't like it then we'll have lots of opportunities to address it. 😄 Unfortunately he never discussed releasing new gems with me so I'm still stuck on that front. I'll keep following up to see if I can gain the required access for that. 😦 |
Add ability to load custom holidays on the fly
At my company we have several company-specific holidays (special payroll days, important company holidays, etc). Since they are not general holidays we wouldn't want them added to the overall definitions available in the gem but we would still want them included in the gem calculations as needed for our own purposes. To accomplish this I have added the ability to load custom definitions on the fly and have them be immediately available for use.
In order to do this I've moved the parsing of definition files into the main Holidays module instead of having the logic reside in the 'data/build_defs.rb' file. I've split up the logic into multiple methods for code clarity and renamed a few variables but the core logic is unchanged. All definition files are generated the same and all tests still pass. With the parsing logic inside the Holidays module we can now call it when loading custom files on the fly.
I decided in the end to simply add these changes into the 'lib/holidays.rb' file but it could be added into a separate file instead if you feel that would make for a cleaner codebase.