diff options
author | rick <technoweenie@gmail.com> | 2009-05-17 19:16:11 -0700 |
---|---|---|
committer | rick <technoweenie@gmail.com> | 2009-05-17 19:18:00 -0700 |
commit | e89241c92fbcf68b59d9efb50c21c5040e9f3156 (patch) | |
tree | 163f0fb1b9d048e7610bec789bf08eb0ada40c95 /activesupport/lib/active_support/json/backends | |
parent | b0de061e7b8d3c291a328f6b0b9bfc5f48b2f907 (diff) | |
download | rails-e89241c92fbcf68b59d9efb50c21c5040e9f3156.tar.gz rails-e89241c92fbcf68b59d9efb50c21c5040e9f3156.tar.bz2 rails-e89241c92fbcf68b59d9efb50c21c5040e9f3156.zip |
load the JSON Backend lazily. If the JSON gem is already loaded, use the JSONGem backend by default.
Diffstat (limited to 'activesupport/lib/active_support/json/backends')
-rw-r--r-- | activesupport/lib/active_support/json/backends/jsongem.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/json/backends/yaml.rb | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/json/backends/jsongem.rb b/activesupport/lib/active_support/json/backends/jsongem.rb index d1a1cdd7d7..649e6301d1 100644 --- a/activesupport/lib/active_support/json/backends/jsongem.rb +++ b/activesupport/lib/active_support/json/backends/jsongem.rb @@ -1,6 +1,8 @@ +require 'json' unless defined?(JSON) + module ActiveSupport module JSON - ParseError = ::JSON::ParserError + ParseError = ::JSON::ParserError unless const_defined?(:ParseError) module Backends module JSONGem diff --git a/activesupport/lib/active_support/json/backends/yaml.rb b/activesupport/lib/active_support/json/backends/yaml.rb index 1c18fc4801..667016f45d 100644 --- a/activesupport/lib/active_support/json/backends/yaml.rb +++ b/activesupport/lib/active_support/json/backends/yaml.rb @@ -2,7 +2,9 @@ require 'active_support/core_ext/string/starts_ends_with' module ActiveSupport module JSON - class ParseError < StandardError + unless const_defined?(:ParseError) + class ParseError < StandardError + end end module Backends |