aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/json.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-03-03 19:34:23 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-03-03 19:34:23 +0000
commit2e67f1adc8e52121270d1139665a965e3f0792d8 (patch)
treeccaf6b866c3895fede3fd00bf849a1f542394cf9 /activesupport/lib/active_support/json.rb
parent116658e69b9c4a722e6ae8717629b8cd0057db89 (diff)
downloadrails-2e67f1adc8e52121270d1139665a965e3f0792d8.tar.gz
rails-2e67f1adc8e52121270d1139665a965e3f0792d8.tar.bz2
rails-2e67f1adc8e52121270d1139665a965e3f0792d8.zip
RJS now does enumerations, baby! (closes #3876) [Rick Olson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3754 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/json.rb')
-rw-r--r--activesupport/lib/active_support/json.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/json.rb b/activesupport/lib/active_support/json.rb
index 77c7225c66..943adebd35 100644
--- a/activesupport/lib/active_support/json.rb
+++ b/activesupport/lib/active_support/json.rb
@@ -3,7 +3,15 @@ require 'active_support/json/encoders'
module ActiveSupport
module JSON #:nodoc:
class CircularReferenceError < StandardError; end
-
+ # returns the literal string as its JSON encoded form. Useful for passing javascript variables into functions.
+ #
+ # page.call 'Element.show', ActiveSupport::JSON::Variable.new("$$(#items li)")
+ class Variable < String
+ def to_json
+ self
+ end
+ end
+
class << self
REFERENCE_STACK_VARIABLE = :json_reference_stack