Class: Rambling::Trie::Compressor
- Inherits:
-
Object
- Object
- Rambling::Trie::Compressor
- Defined in:
- lib/rambling/trie/compressor.rb
Overview
Responsible for the compression process of a trie data structure.
Instance Method Summary collapse
-
#compress(node) ⇒ Nodes::Compressed
Compresses a Node from a trie data structure.
Instance Method Details
#compress(node) ⇒ Nodes::Compressed
Compresses a Node from a trie data structure.
10 11 12 13 14 15 16 |
# File 'lib/rambling/trie/compressor.rb', line 10 def compress node if node.compressible? compress_child_and_merge node else compress_children_and_copy node end end |