-
Notifications
You must be signed in to change notification settings - Fork 581
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
(MODULES-2456) Modify union to accept more than two arrays #507
Conversation
| raise(Puppet::ParseError, "union(): Wrong number of arguments " + | ||
| "given (#{arguments.size} for 2)") if arguments.size != 2 | ||
| # Check that 2 or more arguments have been given ... | ||
| raise(Puppet::ParseError, "concat(): Wrong number of arguments " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean 'union', not 'concat' here?
|
Hi, this seems to be a worthwhile addition. There seems to be one typo in the error message and the actual function body could be simplified significantly. I've pointed that out in code comments. Cheers! |
|
Thanks for the criticism, DavidS. Your comments are all valid. Have made the necessary changes and pushed. |
|
Sweet. Would you mind squashing it into a single commit, just so the history is nice and clean? http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html |
Add spec tests to test the new functionality: *Case for 3 arrays. *Case for 4 arrays. Modify README to note new functionality. This is for issue MODULE-2456, follow the precedent of MODULE-444. This change allows union to be much more useful, unioning many arrays in one line rather than in n lines. Additionally, as this is only added functionality, and does not affect the 2 array case that all modules currently using array are using, it should not affect any existing modules utilizing union. This is now useful, for example, for merging many arrays of resources (eg: packages.) to generate just one list with no duplicates, to avoid duplicate resource declarations.
|
No worries. Complete. Thanks! |
|
Thank you for your contribution! |
(MODULES-2456) Modify union to accept more than two arrays
Add spec tests to test the new functionality:
*Case for 3 arrays.
*Case for 4 arrays.
Modify README to note new functionality.
This is for issue MODULE-2456, follow the precedent of MODULE-444.
This change allows union to be much more useful, unioning many arrays
in one line rather than in n lines. Additionally, as this is only added
functionality, and does not affect the 2 array case that all modules
currently using array are using, it should not affect any existing
modules utilizing union.
This is now useful, for example, for merging many arrays of resources
(eg: packages.) to generate just one list with no duplicates, to avoid
duplicate resource declarations.