aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-06-12 17:46:15 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-06-12 17:46:15 -0500
commit556204abaf95f7c995576cb1358f13de406682ab (patch)
treea84387ac04af8377b25c4c283a522dc82639bb53 /activesupport/lib/active_support/core_ext
parented0cb91a830f317e3a8192a90294c1005f6156c2 (diff)
downloadrails-556204abaf95f7c995576cb1358f13de406682ab.tar.gz
rails-556204abaf95f7c995576cb1358f13de406682ab.tar.bz2
rails-556204abaf95f7c995576cb1358f13de406682ab.zip
Added Enumberable#several? to encapsulate collection.size > 1 [DHH]
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r--activesupport/lib/active_support/core_ext/enumerable.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb
index f1469aa0e3..47ff19e963 100644
--- a/activesupport/lib/active_support/core_ext/enumerable.rb
+++ b/activesupport/lib/active_support/core_ext/enumerable.rb
@@ -66,4 +66,9 @@ module Enumerable
accum
end
end
+
+ # Returns true if the collection has more than 1 element. Functionally equivalent to collection.size > 1.
+ def several?
+ size > 1
+ end
end