Module: ActiveSupport::JSON
- Defined in:
- lib/active_support/json/decoding.rb,
lib/active_support/json/encoding.rb,
lib/active_support/json/variable.rb,
lib/active_support/json/backends/yaml.rb,
lib/active_support/json/backends/jsongem.rb
Defined Under Namespace
Modules: Backends, Encoding Classes: Variable
Constant Summary collapse
- DATE_REGEX =
matches YAML-formatted dates
/^(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[ \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?))$/
- CircularReferenceError =
Deprecation::DeprecatedConstantProxy.new('ActiveSupport::JSON::CircularReferenceError', Encoding::CircularReferenceError)
Class Attribute Summary collapse
-
.parse_error ⇒ Object
readonly
Returns the value of attribute parse_error.
Class Method Summary collapse
Class Attribute Details
.parse_error ⇒ Object (readonly)
Returns the value of attribute parse_error.
9 10 11 |
# File 'lib/active_support/json/decoding.rb', line 9 def parse_error @parse_error end |
Class Method Details
.backend ⇒ Object
12 13 14 15 |
# File 'lib/active_support/json/decoding.rb', line 12 def backend self.backend = "Yaml" unless defined?(@backend) @backend end |
.backend=(name) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/active_support/json/decoding.rb', line 17 def backend=(name) if name.is_a?(Module) @backend = name else require "active_support/json/backends/#{name.to_s.downcase}.rb" @backend = ActiveSupport::JSON::Backends::const_get(name) end @parse_error = @backend::ParseError end |
.with_backend(name) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/active_support/json/decoding.rb', line 27 def with_backend(name) old_backend, self.backend = backend, name yield ensure self.backend = old_backend end |