Class: Rambling::Trie::Nodes::Raw
- Defined in:
- lib/rambling/trie/nodes/raw.rb
Overview
A representation of a node in an uncompressed trie data structure. :reek:RepeatedConditional { max_ifs: 4 }
Constant Summary
Constants included from Enumerable
Instance Attribute Summary
Attributes inherited from Node
#children_tree, #letter, #parent
Instance Method Summary collapse
-
#add(reversed_chars) ⇒ Node
Adds a word to the current raw (uncompressed) trie node.
-
#compressed? ⇒ Boolean
Always return ‘false` for a raw (uncompressed) node.
Methods inherited from Node
#[], #[]=, #children, #delete, #first_child, #initialize, #key?, #match_prefix, #partial_word?, #root?, #scan, #terminal!, #terminal?, #word?
Methods included from Inspectable
Methods included from Stringifyable
Methods included from Comparable
Methods included from Enumerable
Methods included from Compressible
Constructor Details
This class inherits a constructor from Rambling::Trie::Nodes::Node
Instance Method Details
#add(reversed_chars) ⇒ Node
Note:
This method clears the contents of the chars variable.
Adds a word to the current raw (uncompressed) trie node.
13 14 15 16 17 18 19 20 |
# File 'lib/rambling/trie/nodes/raw.rb', line 13 def add reversed_chars if reversed_chars.empty? terminal! unless root? self else add_to_children_tree reversed_chars end end |
#compressed? ⇒ Boolean
Always return ‘false` for a raw (uncompressed) node.
24 25 26 |
# File 'lib/rambling/trie/nodes/raw.rb', line 24 def compressed? false end |