Skip to content
Browse files

Revert "Deprecate ActiveSupport::JSON::Variable"

This reverts commit bcfa013.
  • Loading branch information...
1 parent 857697b commit af65b8c9e75052c8ec282e9676502a3a9506ac89 @rafaelfranca rafaelfranca committed Aug 1, 2012
View
16 activesupport/CHANGELOG.md
@@ -1,14 +1,18 @@
## Rails 3.2.8 ##
-* No changes.
+* Reverted the deprecation of ActiveSupport::JSON::Variable. *Rafael Mendonça França*
## Rails 3.2.7 (Jul 26, 2012) ##
-* Hash#fetch(fetch) is not the same as doing hash[key]
-* adds a missing require [fixes #6896]
-* make sure the inflection rules are loaded when cherry-picking active_support/core_ext/string/inflections.rb [fixes #6884]
-* Merge pull request #6857 from rsutphin/as_core_ext_time_missing_require
-* bump AS deprecation_horizon to 4.0
+* Hash#fetch(fetch) is not the same as doing hash[key]
+
+* adds a missing require [fixes #6896]
+
+* make sure the inflection rules are loaded when cherry-picking active_support/core_ext/string/inflections.rb [fixes #6884]
+
+* Merge pull request #6857 from rsutphin/as_core_ext_time_missing_require
+
+* bump AS deprecation_horizon to 4.0
## Rails 3.2.6 (Jun 12, 2012) ##
View
10 activesupport/lib/active_support/json/variable.rb
@@ -1,15 +1,7 @@
-require 'active_support/deprecation'
-
module ActiveSupport
module JSON
- # Deprecated: A string that returns itself as its JSON-encoded form.
+ # A string that returns itself as its JSON-encoded form.
class Variable < String
- def initialize(*args)
- ActiveSupport::Deprecation.warn 'ActiveSupport::JSON::Variable is deprecated and will be removed in Rails 4.0. ' \
- 'For your own custom JSON literals, define #as_json and #encode_json yourself.'
- super
- end
-
def as_json(options = nil) self end #:nodoc:
def encode_json(encoder) self end #:nodoc:
end
View
11 activesupport/test/json/encoding_test.rb
@@ -3,7 +3,7 @@
require 'active_support/core_ext/string/inflections'
require 'active_support/json'
-class TestJSONEncoding < ActiveSupport::TestCase
+class TestJSONEncoding < Test::Unit::TestCase
class Foo
def initialize(a, b)
@a, @b = a, b
@@ -46,6 +46,8 @@ def as_json(options)
HashlikeTests = [[ Hashlike.new, %({\"a\":1}) ]]
CustomTests = [[ Custom.new, '"custom"' ]]
+ VariableTests = [[ ActiveSupport::JSON::Variable.new('foo'), 'foo'],
+ [ ActiveSupport::JSON::Variable.new('alert("foo")'), 'alert("foo")']]
RegexpTests = [[ /^a/, '"(?-mix:^a)"' ], [/^\w{1,2}[a-z]+/ix, '"(?ix-m:^\\\\w{1,2}[a-z]+)"']]
DateTests = [[ Date.new(2005,2,1), %("2005/02/01") ]]
@@ -77,13 +79,6 @@ def sorted_json(json)
end
end
- def test_json_variable
- assert_deprecated do
- assert_equal ActiveSupport::JSON::Variable.new('foo'), 'foo'
- assert_equal ActiveSupport::JSON::Variable.new('alert("foo")'), 'alert("foo")'
- end
- end
-
def test_hash_encoding
assert_equal %({\"a\":\"b\"}), ActiveSupport::JSON.encode(:a => :b)
assert_equal %({\"a\":1}), ActiveSupport::JSON.encode('a' => 1)

0 comments on commit af65b8c

Please sign in to comment.
Something went wrong with that request. Please try again.