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.5.1 lib/picky/backends/memory/marshal.rb
picky-4.5.0 lib/picky/backends/memory/marshal.rb
picky-4.4.2 lib/picky/backends/memory/marshal.rb
picky-4.4.1 lib/picky/backends/memory/marshal.rb
picky-4.4.0 lib/picky/backends/memory/marshal.rb
picky-4.3.2 lib/picky/backends/memory/marshal.rb
picky-4.3.1 lib/picky/backends/memory/marshal.rb
picky-4.3.0 lib/picky/backends/memory/marshal.rb
picky-4.2.4 lib/picky/backends/memory/marshal.rb
picky-4.2.3 lib/picky/backends/memory/marshal.rb
picky-4.2.2 lib/picky/backends/memory/marshal.rb
picky-4.2.1 lib/picky/backends/memory/marshal.rb
picky-4.2.0 lib/picky/backends/memory/marshal.rb
picky-4.1.0 lib/picky/backends/memory/marshal.rb
picky-4.0.9 lib/picky/backends/memory/marshal.rb
picky-4.0.8 lib/picky/backends/memory/marshal.rb
picky-4.0.7 lib/picky/backends/memory/marshal.rb
picky-4.0.6 lib/picky/backends/memory/marshal.rb
picky-4.0.5 lib/picky/backends/memory/marshal.rb
picky-4.0.4 lib/picky/backends/memory/marshal.rb