From 8d1a292047d9dac8cccb8228bf420d78a495b95d Mon Sep 17 00:00:00 2001 From: Anton Davydov Date: Thu, 21 May 2015 21:26:41 +0300 Subject: [skip ci] Update documentation for ArrayInquirer#any? --- activesupport/lib/active_support/array_inquirer.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'activesupport/lib/active_support/array_inquirer.rb') 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 -- cgit v1.2.3