Sha256: 1dcfa378360101df139fe52c661b7cfc52cbbf92f0a85919b6a11f36551dcb6a

Contents?: true

Size: 916 Bytes

Versions: 3

Compression:

Stored size: 916 Bytes

Contents

require 'active_support/core_ext/module/attribute_accessors'
require 'active_support/core_ext/module/delegation'

module ActiveSupport
  # Look for and parse json strings that look like ISO 8601 times.
  mattr_accessor :parse_json_times

  module JSON
    class << self
      attr_reader :parse_error
      delegate :decode, :to => :backend

      def backend
        self.backend = "Yaml" unless defined?(@backend)
        @backend
      end

      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

      def with_backend(name)
        old_backend, self.backend = backend, name
        yield
      ensure
        self.backend = old_backend
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
activesupport-3.0.0.beta lib/active_support/json/decoding.rb
activesupport-3.0.pre lib/active_support/json/decoding.rb
recliner-0.0.1 vendor/activesupport/lib/active_support/json/decoding.rb