gems.multi_json-1.11.0.lib.multi_json.adapters.ok_json.rb Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sass-maven-plugin Show documentation
Show all versions of sass-maven-plugin Show documentation
A Maven Plugin that compiles Sass files.
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={})
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
© 2015 - 2025 Weber Informatics LLC | Privacy Policy