aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-05-28 03:10:51 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-05-28 03:10:51 -0500
commit070fb46295131da50df3048f70acfa7630267efa (patch)
tree04cc2688842b1bc43b09b59e0c345970eb8685b4 /activesupport/lib
parenta3d18d2ec0d73ed8eb92c913e324884aab7aa85b (diff)
downloadrails-070fb46295131da50df3048f70acfa7630267efa.tar.gz
rails-070fb46295131da50df3048f70acfa7630267efa.tar.bz2
rails-070fb46295131da50df3048f70acfa7630267efa.zip
add example to ActiveSupport::JSON.encode [ci skip]
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/json/encoding.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb
index a6e4e7ced2..6a4ddb1602 100644
--- a/activesupport/lib/active_support/json/encoding.rb
+++ b/activesupport/lib/active_support/json/encoding.rb
@@ -25,7 +25,10 @@ module ActiveSupport
# matches YAML-formatted dates
DATE_REGEX = /^(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[T \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?))$/
- # Dumps object in JSON (JavaScript Object Notation). See www.json.org for more info.
+ # Dumps objects in JSON (JavaScript Object Notation). See www.json.org for more info.
+ #
+ # ActiveSupport::JSON.encode({team: 'rails', players: '36'})
+ # # => "{\"team\":\"rails\",\"players\":\"36\"}"
def self.encode(value, options = nil)
Encoding::Encoder.new(options).encode(value)
end