Module: ActiveSupport::JSON::Encoding
- Defined in:
- activesupport/lib/active_support/json/encoding.rb
Overview
:nodoc:
Defined Under Namespace
Classes: JSONGemCoderEncoder, JSONGemEncoder
Constant Summary collapse
- U2028 =
-"\u2028".b
- U2029 =
-"\u2029".b
- ESCAPED_CHARS =
{ U2028 => '\u2028'.b, U2029 => '\u2029'.b, ">".b => '\u003e'.b, "<".b => '\u003c'.b, "&".b => '\u0026'.b, }
- ESCAPE_REGEX_WITH_HTML_ENTITIES =
Regexp.union(*ESCAPED_CHARS.keys)
- ESCAPE_REGEX_WITHOUT_HTML_ENTITIES =
Regexp.union(U2028, U2029)
Class Attribute Summary collapse
-
.escape_html_entities_in_json ⇒ Object
If true, encode >, <, & as escaped unicode sequences (e.g. > as u003e) as a safety measure.
-
.json_encoder ⇒ Object
Sets the encoder used by Rails to encode Ruby objects into JSON strings in Object#to_json and
ActiveSupport::JSON.encode
. -
.time_precision ⇒ Object
Sets the precision of encoded time values.
-
.use_standard_json_time_format ⇒ Object
If true, use ISO 8601 format for dates and times.
Class Method Summary collapse
Class Attribute Details
.escape_html_entities_in_json ⇒ Object
If true, encode >, <, & as escaped unicode sequences (e.g. > as u003e) as a safety measure.
196 197 198 |
# File 'activesupport/lib/active_support/json/encoding.rb', line 196 def escape_html_entities_in_json @escape_html_entities_in_json end |
.json_encoder ⇒ Object
Sets the encoder used by Rails to encode Ruby objects into JSON strings in Object#to_json and ActiveSupport::JSON.encode
.
204 205 206 |
# File 'activesupport/lib/active_support/json/encoding.rb', line 204 def json_encoder @json_encoder end |
.time_precision ⇒ Object
Sets the precision of encoded time values. Defaults to 3 (equivalent to millisecond precision)
200 201 202 |
# File 'activesupport/lib/active_support/json/encoding.rb', line 200 def time_precision @time_precision end |
.use_standard_json_time_format ⇒ Object
If true, use ISO 8601 format for dates and times. Otherwise, fall back to the Active Support legacy format.
192 193 194 |
# File 'activesupport/lib/active_support/json/encoding.rb', line 192 def use_standard_json_time_format @use_standard_json_time_format end |
Class Method Details
.encode_without_options(value) ⇒ Object
:nodoc:
211 212 213 |
# File 'activesupport/lib/active_support/json/encoding.rb', line 211 def (value) # :nodoc: @encoder_without_options.encode(value) end |