Sha256: 06134bb6b4331b2bab6b8bccc0b705b5e57509b7df43ce29993ce9138f84663f

Contents?: true

Size: 662 Bytes

Versions: 1

Compression:

Stored size: 662 Bytes

Contents

module Backend
  
  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
      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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
picky-2.6.0 lib/picky/backend/file/json.rb