diff options
Diffstat (limited to 'activesupport/lib/active_support/json')
5 files changed, 6 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/json/decoding.rb b/activesupport/lib/active_support/json/decoding.rb index fdb219dbf7..9da4048272 100644 --- a/activesupport/lib/active_support/json/decoding.rb +++ b/activesupport/lib/active_support/json/decoding.rb @@ -16,7 +16,7 @@ module ActiveSupport protected # matches YAML-formatted dates - DATE_REGEX = /^\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[ \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?)?$/ + DATE_REGEX = /^(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[ \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?)?)$/ # Ensure that ":" and "," are always followed by a space def convert_json_to_yaml(json) #:nodoc: diff --git a/activesupport/lib/active_support/json/encoders/date.rb b/activesupport/lib/active_support/json/encoders/date.rb index 1fc99c466f..cc84de1388 100644 --- a/activesupport/lib/active_support/json/encoders/date.rb +++ b/activesupport/lib/active_support/json/encoders/date.rb @@ -2,7 +2,7 @@ class Date # Returns a JSON string representing the date. If ActiveSupport.use_standard_json_time_format is set to true, the # ISO 8601 format is used. # - # ==== Examples: + # ==== Examples # # # With ActiveSupport.use_standard_json_time_format = true # Date.new(2005,2,1).to_json diff --git a/activesupport/lib/active_support/json/encoders/date_time.rb b/activesupport/lib/active_support/json/encoders/date_time.rb index e259930033..6c85824105 100644 --- a/activesupport/lib/active_support/json/encoders/date_time.rb +++ b/activesupport/lib/active_support/json/encoders/date_time.rb @@ -2,7 +2,7 @@ class DateTime # Returns a JSON string representing the datetime. If ActiveSupport.use_standard_json_time_format is set to true, the # ISO 8601 format is used. # - # ==== Examples: + # ==== Examples # # # With ActiveSupport.use_standard_json_time_format = true # DateTime.civil(2005,2,1,15,15,10).to_json diff --git a/activesupport/lib/active_support/json/encoders/hash.rb b/activesupport/lib/active_support/json/encoders/hash.rb index b9bdd55fa5..16dc8337f5 100644 --- a/activesupport/lib/active_support/json/encoders/hash.rb +++ b/activesupport/lib/active_support/json/encoders/hash.rb @@ -5,7 +5,7 @@ class Hash # the hash keys. For example: # # { :name => "Konata Izumi", 'age' => 16, 1 => 2 }.to_json - # # => {"name": "Konata Izumi", 1: 2, "age": 16} + # # => {"name": "Konata Izumi", "1": 2, "age": 16} # # The keys in the JSON string are unordered due to the nature of hashes. # @@ -39,7 +39,7 @@ class Hash returning result = '{' do result << hash_keys.map do |key| - "#{ActiveSupport::JSON.encode(key)}: #{ActiveSupport::JSON.encode(self[key], options)}" + "#{ActiveSupport::JSON.encode(key.to_s)}: #{ActiveSupport::JSON.encode(self[key], options)}" end * ', ' result << '}' end diff --git a/activesupport/lib/active_support/json/encoders/time.rb b/activesupport/lib/active_support/json/encoders/time.rb index 09fc614889..f45a0059e8 100644 --- a/activesupport/lib/active_support/json/encoders/time.rb +++ b/activesupport/lib/active_support/json/encoders/time.rb @@ -2,7 +2,7 @@ class Time # Returns a JSON string representing the time. If ActiveSupport.use_standard_json_time_format is set to true, the # ISO 8601 format is used. # - # ==== Examples: + # ==== Examples # # # With ActiveSupport.use_standard_json_time_format = true # Time.utc(2005,2,1,15,15,10).to_json |