Sha256: daf1489e0eb5dd61e4d57d558c46ea2214a03093360e374b1c0d47d294f51c2d

Contents?: true

Size: 883 Bytes

Versions: 133

Compression:

Stored size: 883 Bytes

Contents

# frozen_string_literal: true

require 'json'
require_relative 'json/builder'
require_relative 'json/error_handler'
require_relative 'json/handler'
require_relative 'json/parser'
require_relative 'json/json_engine'
require_relative 'json/oj_engine'

module Aws
  # @api private
  module Json
    class ParseError < StandardError
      def initialize(error)
        @error = error
        super(error.message)
      end

      attr_reader :error
    end

    class << self
      def load(json)
        ENGINE.load(json)
      end

      def load_file(path)
        load(File.open(path, 'r', encoding: 'UTF-8', &:read))
      end

      def dump(value)
        ENGINE.dump(value)
      end

      private

      def select_engine
        require 'oj'
        OjEngine
      rescue LoadError
        JSONEngine
      end
    end

    # @api private
    ENGINE = select_engine
  end
end

Version data entries

133 entries across 133 versions & 1 rubygems

Version Path
aws-sdk-core-3.198.0 lib/aws-sdk-core/json.rb
aws-sdk-core-3.197.2 lib/aws-sdk-core/json.rb
aws-sdk-core-3.197.1 lib/aws-sdk-core/json.rb
aws-sdk-core-3.197.0 lib/aws-sdk-core/json.rb
aws-sdk-core-3.194.1 lib/aws-sdk-core/json.rb
aws-sdk-core-3.194.0 lib/aws-sdk-core/json.rb
aws-sdk-core-3.193.0 lib/aws-sdk-core/json.rb
aws-sdk-core-3.192.1 lib/aws-sdk-core/json.rb
aws-sdk-core-3.192.0 lib/aws-sdk-core/json.rb
aws-sdk-core-3.191.6 lib/aws-sdk-core/json.rb
aws-sdk-core-3.191.5 lib/aws-sdk-core/json.rb
aws-sdk-core-3.191.4 lib/aws-sdk-core/json.rb
aws-sdk-core-3.191.3 lib/aws-sdk-core/json.rb
aws-sdk-core-3.191.2 lib/aws-sdk-core/json.rb
aws-sdk-core-3.191.1 lib/aws-sdk-core/json.rb
aws-sdk-core-3.191.0 lib/aws-sdk-core/json.rb
aws-sdk-core-3.190.3 lib/aws-sdk-core/json.rb
aws-sdk-core-3.190.2 lib/aws-sdk-core/json.rb
aws-sdk-core-3.190.1 lib/aws-sdk-core/json.rb
aws-sdk-core-3.190.0 lib/aws-sdk-core/json.rb