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

Object#in? also accepts multiple parameters #3767

Merged
merged 1 commit into from
Nov 27, 2011
Merged

Object#in? also accepts multiple parameters #3767

merged 1 commit into from
Nov 27, 2011

Conversation

tadast
Copy link
Contributor

@tadast tadast commented Nov 26, 2011

This is just a suggestion, but since the change is quite simple, I've created a pull request. The idea is to allow passing multiple arguments to Object#in? method, like:

animal = "cat"
animal.in?("dog", "cat", "rat")

currently, you'd have to do something like this:

animal = "cat"
animal.in?(["bat", "cat", "rat"])

which is not very nice. Implementation also preserves current behaviour.
Do you think it would be useful?

@wycats
Copy link
Member

wycats commented Nov 27, 2011

This was the implementation in Merb. I like it.

wycats added a commit that referenced this pull request Nov 27, 2011
Object#in? also accepts multiple parameters
@wycats wycats merged commit 3c81fc3 into rails:master Nov 27, 2011
@sikachu
Copy link
Member

sikachu commented Nov 27, 2011

@wycats I originally propose this varargs version in #258, but I think either @dhh or @tenderlove rejected it.

Does @dhh and @tenderlove feels ok after this get merged in?

@fxn
Copy link
Member

fxn commented Nov 27, 2011

@tadast could you please update the AS core extensions guide please? Here http://edgeguides.rubyonrails.org/active_support_core_extensions.html#in

@tadast
Copy link
Contributor Author

tadast commented Nov 27, 2011

@fxn
Copy link
Member

fxn commented Nov 27, 2011

@tadast excellent thanks!

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.

None yet

4 participants