aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/json/backends/jsongem.rb5
-rw-r--r--activesupport/lib/active_support/json/backends/yaml.rb6
-rw-r--r--activesupport/lib/active_support/json/decoding.rb2
3 files changed, 5 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/json/backends/jsongem.rb b/activesupport/lib/active_support/json/backends/jsongem.rb
index 649e6301d1..c6c17a3c4e 100644
--- a/activesupport/lib/active_support/json/backends/jsongem.rb
+++ b/activesupport/lib/active_support/json/backends/jsongem.rb
@@ -2,10 +2,9 @@ require 'json' unless defined?(JSON)
module ActiveSupport
module JSON
- ParseError = ::JSON::ParserError unless const_defined?(:ParseError)
-
module Backends
module JSONGem
+ ParseError = ::JSON::ParserError
extend self
# Parses a JSON string or IO and convert it into an object
@@ -38,4 +37,4 @@ module ActiveSupport
end
end
end
-end \ No newline at end of file
+end
diff --git a/activesupport/lib/active_support/json/backends/yaml.rb b/activesupport/lib/active_support/json/backends/yaml.rb
index 59d2c37e40..215b3d6f90 100644
--- a/activesupport/lib/active_support/json/backends/yaml.rb
+++ b/activesupport/lib/active_support/json/backends/yaml.rb
@@ -2,13 +2,9 @@ require 'active_support/core_ext/string/starts_ends_with'
module ActiveSupport
module JSON
- unless const_defined?(:ParseError)
- class ParseError < StandardError
- end
- end
-
module Backends
module Yaml
+ ParseError = ::StandardError
extend self
# Parses a JSON string or IO and converts it into an object
diff --git a/activesupport/lib/active_support/json/decoding.rb b/activesupport/lib/active_support/json/decoding.rb
index 356b6cebeb..a5908365af 100644
--- a/activesupport/lib/active_support/json/decoding.rb
+++ b/activesupport/lib/active_support/json/decoding.rb
@@ -7,6 +7,7 @@ module ActiveSupport
module JSON
class << self
+ attr_reader :parse_error
delegate :decode, :to => :backend
def backend
@@ -21,6 +22,7 @@ module ActiveSupport
require "active_support/json/backends/#{name.to_s.downcase}.rb"
@backend = ActiveSupport::JSON::Backends::const_get(name)
end
+ @parse_error = @backend::ParseError
end
def with_backend(name)