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.30.0 lib/picky/backends/memory/marshal.rb
picky-4.29.0 lib/picky/backends/memory/marshal.rb
picky-4.28.1 lib/picky/backends/memory/marshal.rb
picky-4.27.1 lib/picky/backends/memory/marshal.rb
picky-4.27.0 lib/picky/backends/memory/marshal.rb
picky-4.26.2 lib/picky/backends/memory/marshal.rb
picky-4.26.1 lib/picky/backends/memory/marshal.rb
picky-4.26.0 lib/picky/backends/memory/marshal.rb
picky-4.25.3 lib/picky/backends/memory/marshal.rb
picky-4.25.2 lib/picky/backends/memory/marshal.rb
picky-4.25.1 lib/picky/backends/memory/marshal.rb
picky-4.25.0 lib/picky/backends/memory/marshal.rb
picky-4.24.0 lib/picky/backends/memory/marshal.rb
picky-4.23.2 lib/picky/backends/memory/marshal.rb
picky-4.23.1 lib/picky/backends/memory/marshal.rb
picky-4.23.0 lib/picky/backends/memory/marshal.rb
picky-4.22.0 lib/picky/backends/memory/marshal.rb
picky-4.21.2 lib/picky/backends/memory/marshal.rb
picky-4.21.1 lib/picky/backends/memory/marshal.rb
picky-4.21.0 lib/picky/backends/memory/marshal.rb