Sha256: 98e77c4defac4436e4899495d03d11e0c3785c3c826eb0b23861ca766a241bf5
Contents?: true
Size: 970 Bytes
Versions: 1
Compression:
Stored size: 970 Bytes
Contents
module Picky module Backends module File # Index files dumped in the JSON format. # class JSON < Basic # Uses the extension "json". # def extension :json end # Loads the index hash from json format. # def load Yajl::Parser.parse ::File.open(cache_path, 'r'), symbolize_keys: true # Note: Circumvents the yajl symbolize utf-8 characters problem. # # Yajl::Parser.parse(::File.open(cache_path, 'r')).inject({}) do |hash, (k, v)| # hash[k.to_sym] = v # hash # end end # Dumps the index hash in json format. # def dump hash hash.dump_json cache_path end # A json file does not provide retrieve functionality. # def retrieve raise "Can't retrieve from JSON file. Use text file." end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
picky-3.1.0 | lib/picky/backends/file/json.rb |