提交 7c34548f 编写于 作者: J Juanito Fatas

Use include? instead of in? for Enumerable#without.

[egilburg]
上级 afd1a870
...@@ -69,7 +69,7 @@ def exclude?(object) ...@@ -69,7 +69,7 @@ def exclude?(object)
# {foo: 1, bar: 2, baz: 3}.without :bar # {foo: 1, bar: 2, baz: 3}.without :bar
# => {foo: 1, baz: 3} # => {foo: 1, baz: 3}
def without(*elements) def without(*elements)
reject { |element| element.in?(elements) } reject { |element| elements.include?(element) }
end end
end end
......
require 'abstract_unit' require 'abstract_unit'
require 'active_support/core_ext/array' require 'active_support/core_ext/array'
require 'active_support/core_ext/enumerable' require 'active_support/core_ext/enumerable'
require 'active_support/core_ext/object/inclusion'
Payment = Struct.new(:price) Payment = Struct.new(:price)
class SummablePayment < Payment class SummablePayment < Payment
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册