Skip to content
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

Merged
merged 4 commits into from
Dec 9, 2014
Merged

Add ability to load custom holidays on the fly #57

merged 4 commits into from
Dec 9, 2014

Conversation

ppeble
Copy link
Member

@ppeble ppeble commented Nov 3, 2013

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.

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.
@ppeble
Copy link
Member Author

ppeble commented Dec 5, 2013

Friendly bump! Please let me know if I need to make any modifications or if you have any suggestions.

@alexdunae
Copy link
Contributor

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.

@jrgifford
Copy link

Any update on this?

@ppeble
Copy link
Member Author

ppeble commented Nov 6, 2014

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.

@jrgifford
Copy link

No worries! Belated congratulations. That’s a valid reason to forget something like that. :-)=

@mowli
Copy link

mowli commented Dec 3, 2014

Is there any chance that this PR will be merged in the near future? Thanks for the info :)

@ppeble
Copy link
Member Author

ppeble commented Dec 3, 2014

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.

@ppeble
Copy link
Member Author

ppeble commented Dec 9, 2014

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. 😦

ppeble added a commit that referenced this pull request Dec 9, 2014
Add ability to load custom holidays on the fly
@ppeble ppeble merged commit f9f9661 into holidays:master Dec 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants