Sha256: 47cf161fbd565bb9bd0be23898a5f70d152070c6d714fdf9f67dbeb1e6efc69a

Contents?: true

Size: 694 Bytes

Versions: 50

Compression:

Stored size: 694 Bytes

Contents

require 'multi_json/adapter'
require 'multi_json/convertible_hash_keys'
require 'multi_json/vendor/okjson'

module MultiJson
  module Adapters
    class OkJson < Adapter
      include ConvertibleHashKeys
      ParseError = ::MultiJson::OkJson::Error

      def load(string, options={})
        string = string.read if string.respond_to?(:read)
        result = ::MultiJson::OkJson.decode("[#{string}]").first
        options[:symbolize_keys] ? symbolize_keys(result) : result
      rescue ArgumentError # invalid byte sequence in UTF-8
        raise ParseError
      end

      def dump(object, options={})
        ::MultiJson::OkJson.valenc(stringify_keys(object))
      end
    end
  end
end

Version data entries

50 entries across 43 versions & 5 rubygems

Version Path
plyom_user-0.0.9 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/ok_json.rb
plyom_user-0.0.8 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/ok_json.rb
plyom_user-0.0.7 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/ok_json.rb
plyom_user-0.0.6 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/ok_json.rb
plyom_user-0.0.5 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/ok_json.rb
plyom_user-0.0.4 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/ok_json.rb
plyom_user-0.0.3 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/ok_json.rb
plyom_user-0.0.2 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/ok_json.rb
multi_json-1.8.2 lib/multi_json/adapters/ok_json.rb
multi_json-1.8.1 lib/multi_json/adapters/ok_json.rb