Methods
Classes and Modules
Module ActiveSupport::JSON::BackendsClass ActiveSupport::JSON::Variable
Constants
DATE_REGEX | = | /^(?:\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})?))$/ |
matches YAML-formatted dates | ||
CircularReferenceError | = | Deprecation::DeprecatedConstantProxy.new('ActiveSupport::JSON::CircularReferenceError', Encoding::CircularReferenceError) |
DECODERS | = | %w(Yajl OkJson) |
Listed in order of preference. |
Attributes
[R] | parse_error |
Public Class methods
[ show source ]
# File activesupport/lib/active_support/json/decoding.rb, line 15 15: def backend 16: set_default_backend unless defined?(@backend) 17: @backend 18: end
[ show source ]
# File activesupport/lib/active_support/json/decoding.rb, line 20 20: def backend=(name) 21: if name.is_a?(Module) 22: @backend = name 23: else 24: require "active_support/json/backends/#{name.to_s.downcase}.rb" 25: @backend = ActiveSupport::JSON::Backends::const_get(name) 26: end 27: @parse_error = @backend::ParseError 28: end
[ show source ]
# File activesupport/lib/active_support/json/decoding.rb, line 37 37: def set_default_backend 38: DECODERS.find do |name| 39: begin 40: self.backend = name 41: true 42: rescue LoadError 43: # Try next decoder. 44: false 45: end 46: end 47: end
[ show source ]
# File activesupport/lib/active_support/json/decoding.rb, line 30 30: def with_backend(name) 31: old_backend, self.backend = backend, name 32: yield 33: ensure 34: self.backend = old_backend 35: end