Module: Rambling::Trie::Comparable

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

Overview

Provides the comparable behavior for the trie data structure.

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Boolean

Compares two nodes.

Parameters:

Returns:



12
13
14
15
16
17
# File 'lib/rambling/trie/comparable.rb', line 12

def == other
  letter == other.letter &&
    terminal? == other.terminal? &&
    value == other.value &&
    children_tree == other.children_tree
end

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

Returns:



16
# File 'sig/lib/rambling/trie/comparable.rbs', line 16

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

#letterSymbol?

Returns:

  • (Symbol, nil)


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

def letter: -> Symbol?

#terminal?Boolean

Returns:

  • (Boolean)


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

def terminal?: -> bool

#valueTValue?

Returns:

  • (TValue, nil)


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

def value: -> TValue?