Class: Rambling::Trie::Serializers::Serializer

Inherits:
Object
  • Object
show all
Defined in:
lib/rambling/trie/serializers/serializer.rb

Overview

Base class for all serializers.

Direct Known Subclasses

File, Marshal, Yaml, Zip

Instance Method Summary collapse

Instance Method Details

#dump(_contents, _filepath) ⇒ Numeric

This method is abstract.

Subclass and override #dump to output the desired format.

Dumps contents into a specified filepath.

Parameters:

  • contents (TContents)

    the contents to dump into given file.

  • filepath (String)

    the filepath to dump the contents to.

Returns:

  • (Numeric)

    number of bytes written to disk.

Raises:

  • (NotImplementedError)

    when not overridden by a subclass



25
26
27
# File 'lib/rambling/trie/serializers/serializer.rb', line 25

def dump _contents, _filepath
  not_implemented
end

#load(_filepath) ⇒ TContents

This method is abstract.

Subclass and override #load to parse the desired format.

Loads contents from a specified filepath.

Parameters:

  • filepath (String)

    the filepath to load contents from.

Returns:

  • (TContents)

    parsed contents from given file.

Raises:

  • (NotImplementedError)

    when not overridden by a subclass



15
16
17
# File 'lib/rambling/trie/serializers/serializer.rb', line 15

def load _filepath
  not_implemented
end