Sha256: 7bfa258ed978ffedccb64734d81a429d05b2c19ba1d686d1c750986ad9d7d53d

Contents?: true

Size: 1018 Bytes

Versions: 127

Compression:

Stored size: 1018 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

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

        # Dumps the index internal backend in marshal format.
        #
        def dump internal
          create_directory cache_path
          dump_marshal internal
        end

        # Dumps binary self to the path given. Minus extension.
        #
        def dump_marshal internal
          ::File.open(cache_path, 'w:binary') do |out_file|
            ::Marshal.dump internal, out_file
          end
        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

127 entries across 127 versions & 1 rubygems

Version Path
picky-4.20.2 lib/picky/backends/memory/marshal.rb
picky-4.20.1 lib/picky/backends/memory/marshal.rb
picky-4.20.0 lib/picky/backends/memory/marshal.rb
picky-4.19.7 lib/picky/backends/memory/marshal.rb
picky-4.19.6 lib/picky/backends/memory/marshal.rb
picky-4.19.5 lib/picky/backends/memory/marshal.rb
picky-4.19.4 lib/picky/backends/memory/marshal.rb
picky-4.19.3 lib/picky/backends/memory/marshal.rb
picky-4.19.2 lib/picky/backends/memory/marshal.rb
picky-4.19.1 lib/picky/backends/memory/marshal.rb
picky-4.19.0 lib/picky/backends/memory/marshal.rb
picky-4.18.0 lib/picky/backends/memory/marshal.rb
picky-4.17.1 lib/picky/backends/memory/marshal.rb
picky-4.17.0 lib/picky/backends/memory/marshal.rb
picky-4.16.0 lib/picky/backends/memory/marshal.rb
picky-4.15.1 lib/picky/backends/memory/marshal.rb
picky-4.15.0 lib/picky/backends/memory/marshal.rb
picky-4.14.0 lib/picky/backends/memory/marshal.rb
picky-4.13.1 lib/picky/backends/memory/marshal.rb
picky-4.13.0 lib/picky/backends/memory/marshal.rb