Module: ActiveSupport::JSON::Encoding
Do not use. This module is for internal use only.
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Defined in: | activesupport/lib/active_support/json/encoding.rb |
Constant Summary
-
ESCAPED_CHARS =
# File 'activesupport/lib/active_support/json/encoding.rb', line 36{ U2028 => '\u2028'.b, U2029 => '\u2029'.b, ">".b => '\u003e'.b, "<".b => '\u003c'.b, "&".b => '\u0026'.b, }
-
ESCAPE_REGEX_WITHOUT_HTML_ENTITIES =
# File 'activesupport/lib/active_support/json/encoding.rb', line 45Regexp.union(U2028, U2029)
-
ESCAPE_REGEX_WITH_HTML_ENTITIES =
# File 'activesupport/lib/active_support/json/encoding.rb', line 44Regexp.union(*ESCAPED_CHARS.keys)
-
U2028 =
# File 'activesupport/lib/active_support/json/encoding.rb', line 33-"\u2028".b
-
U2029 =
# File 'activesupport/lib/active_support/json/encoding.rb', line 34-"\u2029".b
Class Attribute Summary
-
.escape_html_entities_in_json
rw
If true, encode >, <, & as escaped unicode sequences (e.g.
-
.json_encoder
rw
Sets the encoder used by Rails to encode Ruby objects into
::ActiveSupport::JSON
strings inObject#to_json
and encode. - .json_encoder=(encoder) rw
-
.time_precision
rw
Sets the precision of encoded time values.
-
.use_standard_json_time_format
rw
If true, use ISO 8601 format for dates and times.
Class Method Summary
Class Attribute Details
.escape_html_entities_in_json (rw)
If true, encode >, <, & as escaped unicode sequences (e.g. > as u003e) as a safety measure.
# File 'activesupport/lib/active_support/json/encoding.rb', line 168
attr_accessor :escape_html_entities_in_json
.json_encoder (rw)
Sets the encoder used by Rails to encode Ruby objects into ::ActiveSupport::JSON
strings in Object#to_json
and ActiveSupport::JSON.encode.
# File 'activesupport/lib/active_support/json/encoding.rb', line 176
attr_reader :json_encoder
.json_encoder=(encoder) (rw)
[ GitHub ]# File 'activesupport/lib/active_support/json/encoding.rb', line 178
def json_encoder=(encoder) @json_encoder = encoder @encoder_without_options = encoder.new end
.time_precision (rw)
Sets the precision of encoded time values. Defaults to 3 (equivalent to millisecond precision)
# File 'activesupport/lib/active_support/json/encoding.rb', line 172
attr_accessor :time_precision
.use_standard_json_time_format (rw)
If true, use ISO 8601 format for dates and times. Otherwise, fall back to the Active Support legacy format.
# File 'activesupport/lib/active_support/json/encoding.rb', line 164
attr_accessor :use_standard_json_time_format
Class Method Details
.encode_without_options(value)
[ GitHub ]# File 'activesupport/lib/active_support/json/encoding.rb', line 183
def (value) # :nodoc: @encoder_without_options.encode(value) end