Skip to content

Commit

Permalink
Dont be an ass and leave merge shit in stable, please
Browse files Browse the repository at this point in the history
  • Loading branch information
dhh committed Dec 15, 2009
1 parent fda3ac6 commit f039bbb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
15 changes: 6 additions & 9 deletions activesupport/lib/active_support/core_ext/enumerable.rb
Expand Up @@ -102,15 +102,6 @@ def many?(&block)
size = block_given? ? select(&block).size : self.size
size > 1
end
<<<<<<< HEAD
=======

# The negative of the Enumerable#include?. Returns true if the collection does not include the object.
def exclude?(object)
!include?(object)
end
end
>>>>>>> 7b61541... Add Enumerable#exclude? to bring parity to Enumerable#include? and avoid if !x.include?/else calls [DHH]

# Returns true if none of the elements match the given block.
#
Expand All @@ -120,4 +111,10 @@ def exclude?(object)
def none?(&block)
!any?(&block)
end unless [].respond_to?(:none?)


# The negative of the Enumerable#include?. Returns true if the collection does not include the object.
def exclude?(object)
!include?(object)
end
end
4 changes: 1 addition & 3 deletions activesupport/test/core_ext/enumerable_test.rb
Expand Up @@ -83,7 +83,6 @@ def test_many
assert ![ 1, 2 ].many? {|x| x > 1 }
assert [ 1, 2, 2 ].many? {|x| x > 1 }
end
<<<<<<< HEAD

def test_none
assert [].none?
Expand All @@ -94,11 +93,10 @@ def test_none
assert ![ 2 ].none? {|x| x > 1 }
assert ![ 1, 2 ].none? {|x| x > 1 }
assert [ 1, 1 ].none? {|x| x > 1 }
=======
end

def test_exclude?
assert [ 1 ].exclude?(2)
assert ![ 1 ].exclude?(1)
>>>>>>> 7b61541... Add Enumerable#exclude? to bring parity to Enumerable#include? and avoid if !x.include?/else calls [DHH]
end
end

0 comments on commit f039bbb

Please sign in to comment.