Module: Rambling::Trie::Compressible

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

Overview

Provides the compressible behavior for the trie data structure.

Instance Method Summary collapse

Instance Method Details

#children_treeHash[Symbol, Nodes::Node[TValue]]

Returns:



14
# File 'sig/lib/rambling/trie/compressible.rbs', line 14

def children_tree: -> Hash[Symbol, Nodes::Node[TValue]]

#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? && children_tree.one?
end

#root?Boolean

Returns:

  • (Boolean)


10
# File 'sig/lib/rambling/trie/compressible.rbs', line 10

def root?: -> bool

#terminal?Boolean

Returns:

  • (Boolean)


12
# File 'sig/lib/rambling/trie/compressible.rbs', line 12

def terminal?: -> bool