Sha256: 809fafabd5e9c03cbb95db5f962bd18c8bed207b84ccf0d9f022a9be2ca0b63f

Contents?: true

Size: 941 Bytes

Versions: 3

Compression:

Stored size: 941 Bytes

Contents

# frozen_string_literal: true

module Rambling
  module Trie
    module Serializers
      # Base class for all serializers.
      class Serializer
        # Loads contents from a specified filepath.
        # @abstract Subclass and override {#load} to parse the desired format.
        # @param [String] filepath the filepath to load contents from.
        # @return [TContents] parsed contents from given file.
        def load filepath
          raise NotImplementedError
        end

        # Dumps contents into a specified filepath.
        # @abstract Subclass and override {#dump} to output the desired format.
        # @param [TContents] contents the contents to dump into given file.
        # @param [String] filepath the filepath to dump the contents to.
        # @return [Numeric] number of bytes written to disk.
        def dump contents, filepath
          raise NotImplementedError
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rambling-trie-2.5.0 lib/rambling/trie/serializers/serializer.rb
rambling-trie-2.4.0 lib/rambling/trie/serializers/serializer.rb
rambling-trie-2.3.1 lib/rambling/trie/serializers/serializer.rb