Skip to content

(#19272) Add has_element() function #130

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

Merged
merged 1 commit into from
Feb 15, 2013

Conversation

jhoblitt
Copy link

It is exceptionally difficult to determine if an array contains an element matching a specific value without an iteration or loop construct.

This function is the Puppet equivalent of Array.includes?(foo) in Ruby. The implementation is a verbatim copy of has_key() with the minor modifications needed to support arrays instead of hashes.

It is exceptionally difficult to determine if an array contains an element matching a specific value without an iteration or loop construct.

This function is the Puppet equivalent of Array.includes?(foo) in Ruby.  The implementation is a verbatim copy of has_key() with the minor modifications needed to support arrays instead of hashes.
@jeffmccune
Copy link
Contributor

This looks great. Thanks for the contribution and example specs.

jeffmccune pushed a commit that referenced this pull request Feb 15, 2013
(#19272) Add has_element() function
@jeffmccune jeffmccune merged commit f7a1818 into puppetlabs:master Feb 15, 2013
@duritong
Copy link
Contributor

As I commented in http://projects.puppetlabs.com/issues/19272 why is the in-expression not sufficient?

I think we should really not duplicate behavior in the stdlib that the language already provides. So if there is no extra benefit to the in-expression, I would propose to revert this merge.

jeffmccune pushed a commit that referenced this pull request Feb 15, 2013
This reverts commit f7a1818, reversing
changes made to 36a7b29.

I'm reverting this change because of concerns raised by Peter Meier that
it duplicates the "in" operator in the DSL.  The "in" operator is new
information that I did not posses when I made the decision to merge.
Because of this new information I'm un-merging and continuing the
discussion in the comments of
https://projects.puppetlabs.com/issues/19272

Reference: GH-130
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants