From b1968708e12972515fdc8eefdcaff95edbebc76b Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 4 Oct 2007 03:28:42 +0000 Subject: Hash#to_json takes :only or :except options to specific or omit certain hash keys. Enumerable#to_json passes through its options to each element. Closes #9751. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7736 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/json/encoders/string.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/json/encoders/string.rb') diff --git a/activesupport/lib/active_support/json/encoders/string.rb b/activesupport/lib/active_support/json/encoders/string.rb index f357262fc6..963cd10969 100644 --- a/activesupport/lib/active_support/json/encoders/string.rb +++ b/activesupport/lib/active_support/json/encoders/string.rb @@ -17,7 +17,7 @@ module ActiveSupport end class String - def to_json #:nodoc: + def to_json(options = nil) #:nodoc: '"' + gsub(/[\010\f\n\r\t"\\><]/) { |s| ActiveSupport::JSON::Encoding::ESCAPED_CHARS[s] }.gsub(/([\xC0-\xDF][\x80-\xBF]| -- cgit v1.2.3