lib/active_support/json/decoding.rb in activesupport-6.0.6.1 vs lib/active_support/json/decoding.rb in activesupport-6.1.0.rc1

- old
+ new

@@ -8,12 +8,12 @@ # Look for and parse json strings that look like ISO 8601 times. mattr_accessor :parse_json_times module JSON # matches YAML-formatted dates - DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/ - DATETIME_REGEX = /^(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[T \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?)?)$/ + DATE_REGEX = /\A\d{4}-\d{2}-\d{2}\z/ + DATETIME_REGEX = /\A(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[T \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?)?)\z/ class << self # Parses a JSON string (JavaScript Object Notation) into a hash. # See http://www.json.org for more info. # @@ -61,11 +61,11 @@ data end when Array data.map! { |d| convert_dates_from(d) } when Hash - data.each do |key, value| - data[key] = convert_dates_from(value) + data.transform_values! do |value| + convert_dates_from(value) end else data end end