aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/json/encoding.rb
diff options
context:
space:
mode:
authorErich Menge <erich.menge@me.com>2012-05-30 10:24:23 -0500
committerErich Menge <erich.menge@me.com>2012-05-30 10:24:23 -0500
commit624f801d27e946cae2244924e7f6a04565666036 (patch)
tree7de4afec17a1d1d7aa40405f1bc9b89663381b75 /activesupport/lib/active_support/json/encoding.rb
parentf09ae8538f3625468ee175d5a4d9782e0d5ba415 (diff)
downloadrails-624f801d27e946cae2244924e7f6a04565666036.tar.gz
rails-624f801d27e946cae2244924e7f6a04565666036.tar.bz2
rails-624f801d27e946cae2244924e7f6a04565666036.zip
True, False, and Nil should be represented in as_json as themselves.
Conflicts: activesupport/lib/active_support/json/encoding.rb activesupport/test/json/encoding_test.rb
Diffstat (limited to 'activesupport/lib/active_support/json/encoding.rb')
-rw-r--r--activesupport/lib/active_support/json/encoding.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb
index 4a19387511..91e4f07c6c 100644
--- a/activesupport/lib/active_support/json/encoding.rb
+++ b/activesupport/lib/active_support/json/encoding.rb
@@ -158,18 +158,18 @@ class Struct #:nodoc:
end
class TrueClass
- AS_JSON = ActiveSupport::JSON::Variable.new('true').freeze
- def as_json(options = nil) AS_JSON end #:nodoc:
+ def as_json(options = nil) self end #:nodoc:
+ def encode_json(encoder) to_s end #:nodoc:
end
class FalseClass
- AS_JSON = ActiveSupport::JSON::Variable.new('false').freeze
- def as_json(options = nil) AS_JSON end #:nodoc:
+ def as_json(options = nil) self end #:nodoc:
+ def encode_json(encoder) to_s end #:nodoc:
end
class NilClass
- AS_JSON = ActiveSupport::JSON::Variable.new('null').freeze
- def as_json(options = nil) AS_JSON end #:nodoc:
+ def as_json(options = nil) self end #:nodoc:
+ def encode_json(encoder) 'null' end #:nodoc:
end
class String