lib/picky/backends/file/json.rb in picky-4.4.2 vs lib/picky/backends/file/json.rb in picky-4.5.0
- old
+ new
@@ -24,11 +24,11 @@
# 2. Extracts and decodes the object from the file.
#
def [] key
length, offset = mapping[key]
return unless length
- result = Yajl::Parser.parse IO.read(cache_path, length, offset)
+ result = MultiJson.decode IO.read(cache_path, length, offset)
result
end
# Clears the currently loaded index.
#
@@ -63,10 +63,10 @@
mapping = {}
create_directory cache_path
::File.open(cache_path, 'w:utf-8') do |out_file|
hash.each do |(key, object)|
- encoded = Yajl::Encoder.encode object
+ encoded = MultiJson.encode object
length = encoded.size
mapping[key] = [length, offset]
offset += length
out_file.write encoded
end