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
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/ok_json.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/multi_json-1.10.1/lib/multi_json/adapters/ok_json.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/multi_json-1.10.1/lib/multi_json/adapters/ok_json.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/multi_json-1.10.1/lib/multi_json/adapters/ok_json.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/multi_json-1.10.1/lib/multi_json/adapters/ok_json.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/ok_json.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/multi_json-1.10.1/lib/multi_json/adapters/ok_json.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/ok_json.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/multi_json-1.10.1/lib/multi_json/adapters/ok_json.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/ok_json.rb
multi_json-1.10.1 lib/multi_json/adapters/ok_json.rb
multi_json-1.10.0 lib/multi_json/adapters/ok_json.rb
multi_json-1.9.3 lib/multi_json/adapters/ok_json.rb
multi_json-1.9.2 lib/multi_json/adapters/ok_json.rb
multi_json-1.9.1 lib/multi_json/adapters/ok_json.rb
multi_json-1.9.0 lib/multi_json/adapters/ok_json.rb
plyom_user-0.3.1 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/ok_json.rb
plyom_user-0.3.0 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/ok_json.rb
plyom_user-0.2.9 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/ok_json.rb
plyom_user-0.2.8 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/ok_json.rb