aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/json.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-05-24 11:54:27 +0200
committerPratik Naik <pratiknaik@gmail.com>2009-05-24 11:54:27 +0200
commit7324e46a3fe7be282deeda14783f4170ccf03a3c (patch)
tree79968712783f47c816d81e97604f77ff7d920b40 /activesupport/lib/active_support/json.rb
parent1fee2fb996229236fb236bcef423930fdf1dfe2d (diff)
parent6e039e863a5d71f2a516be2eef2605be23281290 (diff)
downloadrails-7324e46a3fe7be282deeda14783f4170ccf03a3c.tar.gz
rails-7324e46a3fe7be282deeda14783f4170ccf03a3c.tar.bz2
rails-7324e46a3fe7be282deeda14783f4170ccf03a3c.zip
Merge commit 'mainstream/master'
Conflicts: actionpack/lib/action_controller/base/mime_responds.rb
Diffstat (limited to 'activesupport/lib/active_support/json.rb')
-rw-r--r--activesupport/lib/active_support/json.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/json.rb b/activesupport/lib/active_support/json.rb
index 5072992cdf..6d845182fb 100644
--- a/activesupport/lib/active_support/json.rb
+++ b/activesupport/lib/active_support/json.rb
@@ -40,9 +40,15 @@ module ActiveSupport
end
class << self
- attr_reader :backend
delegate :decode, :to => :backend
-
+
+ def backend
+ unless defined? @backend
+ self.backend = defined?(::JSON) ? "JSONGem" : "Yaml"
+ end
+ @backend
+ end
+
def backend=(name)
if name.is_a?(Module)
@backend = name
@@ -77,6 +83,5 @@ module ActiveSupport
end
ActiveSupport.escape_html_entities_in_json = true
-ActiveSupport::JSON.backend = 'Yaml'
require 'active_support/json/encoding'