Sha256: f572de54ba1c6d0e514511a042d03affe875c2d7a9f416c7046c8e912ce21b0d

Contents?: true

Size: 670 Bytes

Versions: 25

Compression:

Stored size: 670 Bytes

Contents

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

25 entries across 25 versions & 1 rubygems

Version Path
picky-1.4.1 lib/picky/index/file/json.rb
picky-1.4.0 lib/picky/index/file/json.rb
picky-1.3.4 lib/picky/index/file/json.rb
picky-1.3.3 lib/picky/index/file/json.rb
picky-1.3.2 lib/picky/index/file/json.rb
picky-1.3.1 lib/picky/index/file/json.rb
picky-1.3.0 lib/picky/index/file/json.rb
picky-1.2.4 lib/picky/index/file/json.rb
picky-1.2.3 lib/picky/index/file/json.rb
picky-1.2.2 lib/picky/index/file/json.rb
picky-1.2.1 lib/picky/index/file/json.rb
picky-1.2.0 lib/picky/index/file/json.rb
picky-1.1.7 lib/picky/index/file/json.rb
picky-1.1.6 lib/picky/index/file/json.rb
picky-1.1.5 lib/picky/index/file/json.rb
picky-1.1.4 lib/picky/index/file/json.rb
picky-1.1.3 lib/picky/index/file/json.rb
picky-1.1.2 lib/picky/index/file/json.rb
picky-1.1.1 lib/picky/index/file/json.rb
picky-1.1.0 lib/picky/index/file/json.rb