diff options
author | Abdelkader Boudih <terminale@gmail.com> | 2015-05-21 19:31:54 +0100 |
---|---|---|
committer | Abdelkader Boudih <terminale@gmail.com> | 2015-05-21 19:31:54 +0100 |
commit | 448bf47fe7a1e5c440b7f7fffc12bebd5d649a83 (patch) | |
tree | 5daf8478c408fb86e47bdba92b2fbd366b459650 /activesupport | |
parent | 39037b70efbc4febdb56a91fecd6f3ebd656f8e5 (diff) | |
parent | 8d1a292047d9dac8cccb8228bf420d78a495b95d (diff) | |
download | rails-448bf47fe7a1e5c440b7f7fffc12bebd5d649a83.tar.gz rails-448bf47fe7a1e5c440b7f7fffc12bebd5d649a83.tar.bz2 rails-448bf47fe7a1e5c440b7f7fffc12bebd5d649a83.zip |
Merge pull request #20247 from davydovanton/doc-array-inquirer
Update documentation for ArrayInquirer#any?
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/array_inquirer.rb | 14 |
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 |