lib/picky/backends/file/json.rb in picky-3.6.7 vs lib/picky/backends/file/json.rb in picky-3.6.8
- old
+ new
@@ -6,14 +6,18 @@
# File-based index files dumped in the JSON format.
#
class JSON < Basic
+ attr_writer :mapping
+
# The in-memory mapping hash, mapping
# a Symbol key to [length, offset] of
# the JSON data in the file.
#
- attr_accessor :mapping
+ def mapping
+ @mapping || raise("The File index/category needs to be loaded first.")
+ end
# See lib/picky/backends/file.rb for what this should return.
#
# 1. Gets the length and offset for the key.
# 2. Extracts and decodes the object from the file.