From 6b927b86fa77cbb0e3bd7f042aaec0b2d7cec0fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 17 Jan 2014 00:10:25 -0200 Subject: [PATCH] Remove warnings on Ruby 2.1 Conflicts: activesupport/lib/active_support/hash_with_indifferent_access.rb --- .../lib/active_support/hash_with_indifferent_access.rb | 6 +++++- activesupport/lib/active_support/ordered_hash.rb | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index 56213de50eb16..a98129fb6db4e 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -228,7 +228,11 @@ def deep_symbolize_keys; to_hash.deep_symbolize_keys end def to_options!; self end def select(*args, &block) - dup.select!(*args, &block) + dup.tap { |hash| hash.select!(*args, &block)} + end + + def reject(*args, &block) + dup.tap { |hash| hash.reject!(*args, &block)} end # Convert to a regular hash with string keys. diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb index 1a3693f766de8..8b320f6d05562 100644 --- a/activesupport/lib/active_support/ordered_hash.rb +++ b/activesupport/lib/active_support/ordered_hash.rb @@ -28,6 +28,10 @@ def encode_with(coder) coder.represent_seq '!omap', map { |k,v| { k => v } } end + def reject(*args, &block) + dup.tap { |hash| hash.reject!(*args, &block)} + end + def nested_under_indifferent_access self end