Module: Rambling::Trie::Compressible

Included in:
Nodes::Node
Defined in:
lib/rambling/trie/compressible.rb

Overview

Provides the compressible behavior for the trie data structure.

Instance Method Summary collapse

Instance Method Details

#compressible?Boolean

Indicates if the current Node can be compressed or not.

Returns:

  • (Boolean)

    ‘true` for non-terminal nodes with one child, `false` otherwise.



9
10
11
# File 'lib/rambling/trie/compressible.rb', line 9

def compressible?
  !(root? || terminal?) && 1 == children_tree.size
end