aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorAnton Davydov <antondavydov.o@gmail.com>2015-05-21 21:26:41 +0300
committerAnton Davydov <antondavydov.o@gmail.com>2015-05-21 21:28:17 +0300
commit8d1a292047d9dac8cccb8228bf420d78a495b95d (patch)
treeb1e206974d88304eb871fcd259e69a65fae93b4d /activesupport
parentf271f43f1059982e4e43c29ba2f8abc974ba0ea8 (diff)
downloadrails-8d1a292047d9dac8cccb8228bf420d78a495b95d.tar.gz
rails-8d1a292047d9dac8cccb8228bf420d78a495b95d.tar.bz2
rails-8d1a292047d9dac8cccb8228bf420d78a495b95d.zip
[skip ci] Update documentation for ArrayInquirer#any?
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/array_inquirer.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/array_inquirer.rb b/activesupport/lib/active_support/array_inquirer.rb
index 0ae534da00..e7188d7adb 100644
--- a/activesupport/lib/active_support/array_inquirer.rb
+++ b/activesupport/lib/active_support/array_inquirer.rb
@@ -7,11 +7,17 @@ module ActiveSupport
# variants.phone? # => true
# variants.tablet? # => true
# variants.desktop? # => false
- #
- # variants.any?(:phone, :tablet) # => true
- # variants.any?(:phone, :desktop) # => true
- # variants.any?(:desktop, :watch) # => false
class ArrayInquirer < Array
+ # Passes each element of +candidates+ collection to ArrayInquirer collection.
+ # The method returns true if at least one element is the same. If +candidates+
+ # collection is not given, method returns true.
+ #
+ # variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])
+ #
+ # variants.any? # => true
+ # variants.any?(:phone, :tablet) # => true
+ # variants.any?('phone', 'desktop') # => true
+ # variants.any?(:desktop, :watch) # => false
def any?(*candidates, &block)
if candidates.none?
super