From 7cef8061ab98261887001f8c6fba3f52a85dbaa8 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Thu, 3 Nov 2016 14:15:29 +0000 Subject: Adjust tests for differences between Ruby 1.8 and 1.9 Ruby 1.9 added Hash#select! and return a hash from Hash#select whereas Ruby 1.8 returned an array. --- activesupport/lib/active_support/hash_with_indifferent_access.rb | 6 +----- activesupport/lib/active_support/ordered_hash.rb | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index f89704d906..c02bd60fde 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -153,11 +153,7 @@ module ActiveSupport def symbolize_keys; to_hash.symbolize_keys end def to_options!; self end - if RUBY_VERSION > '2.1.0' - # On Ruby 2.1.1 and later the behavior of .select and reject changed to - # return a new Hash instance so we need to override them to return an - # instance of the correct class. - + if RUBY_VERSION > '1.9' def select(*args, &block) dup.tap { |hash| hash.select!(*args, &block) } end diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb index e81bd013b6..0f9caca892 100644 --- a/activesupport/lib/active_support/ordered_hash.rb +++ b/activesupport/lib/active_support/ordered_hash.rb @@ -52,11 +52,7 @@ module ActiveSupport true end - if RUBY_VERSION > '2.1.0' - # On Ruby 2.1.1 and later the behavior of .select and reject changed to - # return a new Hash instance so we need to override them to return an - # instance of the correct class. - + if RUBY_VERSION > '1.9' def select(*args, &block) dup.tap { |hash| hash.select!(*args, &block) } end -- cgit v1.2.3