Class: RubyTrie::TrieContent
- Inherits:
-
Object
- Object
- RubyTrie::TrieContent
- Defined in:
- lib/ruby_trie.rb
Overview
the content of a TrieNode
Instance Attribute Summary collapse
-
#string ⇒ Object
readonly
symbol at the node, and the entire string to this node are held.
-
#symbol ⇒ Object
readonly
symbol at the node, and the entire string to this node are held.
-
#value ⇒ Object
value can be overwritten.
Instance Method Summary collapse
-
#initialize(str, value = nil) ⇒ TrieContent
constructor
Initialize with the full string (not just the symbol) and an optional value You should not need to use this class unless you start walking the Trie.
-
#to_a ⇒ Object
turn the content into a [symbol, string, value] array.
Constructor Details
#initialize(str, value = nil) ⇒ TrieContent
Initialize with the full string (not just the symbol) and an optional value You should not need to use this class unless you start walking the Trie
28 29 30 31 32 |
# File 'lib/ruby_trie.rb', line 28 def initialize(str, value=nil) @string = str @symbol = str[-1] @value = value end |
Instance Attribute Details
#string ⇒ Object (readonly)
symbol at the node, and the entire string to this node are held
19 20 21 |
# File 'lib/ruby_trie.rb', line 19 def string @string end |
#symbol ⇒ Object (readonly)
symbol at the node, and the entire string to this node are held
19 20 21 |
# File 'lib/ruby_trie.rb', line 19 def symbol @symbol end |
#value ⇒ Object
value can be overwritten
22 23 24 |
# File 'lib/ruby_trie.rb', line 22 def value @value end |
Instance Method Details
#to_a ⇒ Object
turn the content into a [symbol, string, value] array
35 36 37 |
# File 'lib/ruby_trie.rb', line 35 def to_a [@symbol, @string, @value] end |