Class: Containers::Trie::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/containers/trie.rb

Overview

:nodoc: all

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(char, value) ⇒ Node

Returns a new instance of Node.



129
130
131
132
133
134
# File 'lib/containers/trie.rb', line 129

def initialize(char, value)
  @char = char
  @value = value
  @left = @mid = @right = nil
  @end = false
end

Instance Attribute Details

#charObject

Returns the value of attribute char.



127
128
129
# File 'lib/containers/trie.rb', line 127

def char
  @char
end

#endObject

Returns the value of attribute end.



127
128
129
# File 'lib/containers/trie.rb', line 127

def end
  @end
end

#leftObject

Returns the value of attribute left.



127
128
129
# File 'lib/containers/trie.rb', line 127

def left
  @left
end

#midObject

Returns the value of attribute mid.



127
128
129
# File 'lib/containers/trie.rb', line 127

def mid
  @mid
end

#rightObject

Returns the value of attribute right.



127
128
129
# File 'lib/containers/trie.rb', line 127

def right
  @right
end

#valueObject

Returns the value of attribute value.



127
128
129
# File 'lib/containers/trie.rb', line 127

def value
  @value
end

Instance Method Details

#last?Boolean

Returns:

  • (Boolean)


136
137
138
# File 'lib/containers/trie.rb', line 136

def last?
  @end == true
end