diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
3 files changed, 5 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb index 1e0de651c7..d6ae031c0d 100644 --- a/activesupport/lib/active_support/core_ext/array/conversions.rb +++ b/activesupport/lib/active_support/core_ext/array/conversions.rb @@ -1,6 +1,5 @@ require 'active_support/xml_mini' require 'active_support/core_ext/hash/keys' -require 'active_support/core_ext/hash/reverse_merge' require 'active_support/core_ext/string/inflections' class Array @@ -62,14 +61,10 @@ class Array :last_word_connector => ', and ' } if defined?(I18n) - namespace = 'support.array.' - default_connectors.each_key do |name| - i18n_key = (namespace + name.to_s).to_sym - default_connectors[name] = I18n.translate i18n_key, :locale => options[:locale] - end + i18n_connectors = I18n.translate(:'support.array', locale: options[:locale], default: {}) + default_connectors.merge!(i18n_connectors) end - - options.reverse_merge! default_connectors + options = default_connectors.merge!(options) case length when 0 diff --git a/activesupport/lib/active_support/core_ext/hash/keys.rb b/activesupport/lib/active_support/core_ext/hash/keys.rb index 8e728691c6..e753e36124 100644 --- a/activesupport/lib/active_support/core_ext/hash/keys.rb +++ b/activesupport/lib/active_support/core_ext/hash/keys.rb @@ -7,7 +7,7 @@ class Hash # # => { "NAME" => "Rob", "AGE" => "28" } def transform_keys result = {} - keys.each do |key| + each_key do |key| result[yield(key)] = self[key] end result diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index 28c8b53b78..e8623a9c54 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -1,5 +1,6 @@ require 'active_support/duration' require 'active_support/core_ext/time/conversions' +require 'active_support/time_with_zone' class Time COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] |