Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add example to ActiveSupport::JSON.encode [ci skip]

  • Loading branch information...
commit 070fb46295131da50df3048f70acfa7630267efa 1 parent a3d18d2
Francesco Rodriguez authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 activesupport/lib/active_support/json/encoding.rb
View
5 activesupport/lib/active_support/json/encoding.rb
@@ -25,7 +25,10 @@ module JSON
# 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

0 comments on commit 070fb46

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