Sha256: 76013d9f495aa70d91e6ff1ba17134b2e3e7f575d0fdc59ae7707750e56d53a5
Contents?: true
Size: 678 Bytes
Versions: 9
Compression:
Stored size: 678 Bytes
Contents
# encoding: UTF-8 require 'yajl' unless defined?(Yajl::Parser) module JSON class JSONError < StandardError; end unless defined?(JSON::JSONError) class ParserError < JSONError; end unless defined?(JSON::ParserError) def self.default_options @default_options ||= {:symbolize_keys => false} end def self.parse(str, opts=JSON.default_options) begin Yajl::Parser.parse(str, opts) rescue Yajl::ParseError => e raise JSON::ParserError, e.message end end def self.load(input, *args) begin Yajl::Parser.parse(input, default_options) rescue Yajl::ParseError => e raise JSON::ParserError, e.message end end end
Version data entries
9 entries across 9 versions & 2 rubygems