Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Array#include_any? and friends now accept a single argument Array. #18

Conversation

jrafanie
Copy link
Member

@jrafanie jrafanie commented Mar 2, 2015

Fixes:
[1, 2, 3].include_any?([1, 4]) returning false
It should behave the same as [1, 2, 3].include_any?(1, 4)

Single argument Arrays are splat so [1, 4] becomes [[1, 4]]. We have to
grab the first item of the multidimensional array if it's a single subarray.

Fixes:
`[1, 2, 3].include_any?([1, 4])` returning false
It should behave the same as `[1, 2, 3].include_any?(1, 4)`

Single argument Arrays are splat so [1, 4] becomes [[1, 4]].  We have to
grab the first item of the multidimensional array if it's a single subarray.
@bdunne
Copy link
Member

bdunne commented Mar 2, 2015

👍 nice

@miq-bot
Copy link
Member

miq-bot commented Mar 2, 2015

Checked commit jrafanie@84a4498 with rubocop 0.27.1
2 files checked, 12 offenses detected

spec/core_ext/array/inclusions_spec.rb

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 99.88% when pulling 84a4498 on jrafanie:array_include_any_support_single_array_argument into be61d70 on ManageIQ:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 99.88% when pulling 84a4498 on jrafanie:array_include_any_support_single_array_argument into be61d70 on ManageIQ:master.

bdunne added a commit that referenced this pull request Apr 27, 2015
…_array_argument

Array#include_any? and friends now accept a single argument Array.
@bdunne bdunne merged commit a953a45 into ManageIQ:master Apr 27, 2015
@Fryguy
Copy link
Member

Fryguy commented Apr 27, 2015

The reason I didn't write it this way originally is because if you are searching a literal Array, then you can't tell the two cases apart. I think this may need a revert, but we should write a test case for what I described

Fryguy added a commit that referenced this pull request Dec 2, 2015
- Breaking changes
 - Remove Object#namespace [#20]

- Other changes
  - Add ability to pass a transformation block to element_counts [#21]
  - Array#include_any? and friends now accept a single argument Array.
    [#18]
  - Upgraded to RSpec 3 [#16]
  - Added CHANGELOG.md!
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants