提交 070fb462 编写于 作者: F Francesco Rodriguez

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

上级 a3d18d2e
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册