1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #20247 from davydovanton/doc-array-inquirer

Update documentation for ArrayInquirer#any?
This commit is contained in:
Abdelkader Boudih 2015-05-21 19:31:54 +01:00
commit 448bf47fe7

View file

@ -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