Sha256: b9ab39619a8e2e84582e6b822269af1b6f7d1db3b895ac251c2a65ef625f25aa

Contents?: true

Size: 832 Bytes

Versions: 3

Compression:

Stored size: 832 Bytes

Contents

module Picky

  module Backends

    class Memory

      # Index data in the Ruby Marshal format.
      #
      class Marshal < Basic

        # Uses the extension "dump".
        #
        def extension
          :dump
        end

        # The initial content before loading.
        #
        def initial
          {}
        end

        # Loads the index hash from marshal format.
        #
        def load
          ::Marshal.load ::File.open(cache_path, 'r:binary')
        end

        # Dumps the index hash in marshal format.
        #
        def dump hash
          hash.dump_marshal cache_path
        end

        # A marshal file does not provide retrieve functionality.
        #
        def retrieve
          raise "Can't retrieve from marshalled file. Use text file."
        end

      end

    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
picky-3.2.0 lib/picky/backends/memory/marshal.rb
picky-3.1.13 lib/picky/backends/memory/marshal.rb
picky-3.1.12 lib/picky/backends/memory/marshal.rb