Sha256: 9025ac3e95e6e9e2613120f78168fcd7deb9affe0962d7f3d38f050bf51c1dcc
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true require "fast_jsonparser/version" module FastJsonparser Error = Class.new(StandardError) ParseError = Class.new(Error) UnknownError = Class.new(Error) BatchSizeTooSmall = Class.new(Error) DEFAULT_BATCH_SIZE = 1_000_000 # from include/simdjson/dom/parser.h class << self def parse(source, symbolize_keys: true) _parse(source, symbolize_keys) end def load(source, symbolize_keys: true) _load(source, symbolize_keys) end def load_many(source, symbolize_keys: true, batch_size: DEFAULT_BATCH_SIZE, &block) _load_many(source, symbolize_keys, batch_size, &block) rescue UnknownError => error case error.message when "This parser can't support a document that big" raise BatchSizeTooSmall, "One of the documents was bigger than the batch size (#{batch_size}B), try increasing it." else raise end end require "fast_jsonparser/fast_jsonparser" # loads cpp extension private :_parse, :_load, :_load_many end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fast_jsonparser-0.4.0 | lib/fast_jsonparser.rb |