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

Remove Array#inquiry

We are promoting too much a feature that will not be widler used.
So for now lets keep just the ArrayInquirer constructor.
This commit is contained in:
Rafael Mendonça França 2015-03-27 16:25:13 -03:00
parent 5cb8e0046c
commit 9420de59f5
4 changed files with 1 additions and 27 deletions

View file

@ -1,4 +1,4 @@
* Added `ActiveSupport::ArrayInquirer` and `Array#inquiry`.
* Added `ActiveSupport::ArrayInquirer`.
Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its
contents:
@ -13,9 +13,6 @@
variants.any?(:phone, :desktop) # => true
variants.any?(:desktop, :watch) # => false
`Array#inquiry` is a shortcut for wrapping the receiving array in an
`ArrayInquirer`.
*George Claghorn*
* Deprecate `alias_method_chain` in favour of `Module#prepend` introduced in Ruby 2.0

View file

@ -4,4 +4,3 @@ require 'active_support/core_ext/array/conversions'
require 'active_support/core_ext/array/extract_options'
require 'active_support/core_ext/array/grouping'
require 'active_support/core_ext/array/prepend_and_append'
require 'active_support/core_ext/array/inquiry'

View file

@ -1,15 +0,0 @@
class Array
# Wraps the array in an +ArrayInquirer+ object, which gives a friendlier way
# to check its string-like contents.
#
# pets = [:cat, :dog].inquiry
#
# pets.cat? # => true
# pets.ferret? # => false
#
# pets.any?(:cat, :ferret) # => true
# pets.any?(:ferret, :alligator) # => false
def inquiry
ActiveSupport::ArrayInquirer.new(self)
end
end

View file

@ -25,11 +25,4 @@ class ArrayInquirerTest < ActiveSupport::TestCase
def test_respond_to
assert_respond_to @array_inquirer, :development?
end
def test_inquiry
result = [:mobile, :tablet].inquiry
assert_instance_of ActiveSupport::ArrayInquirer, result
assert_equal @array_inquirer, result
end
end