Class: Matchers::Node

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNode

Returns a new instance of Node.



99
100
101
102
103
104
# File 'lib/matcher.rb', line 99

def initialize
  @children = {}
  @children.default = nil
  @output = nil
  @failure = nil
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



96
97
98
# File 'lib/matcher.rb', line 96

def children
  @children
end

#failureObject

Returns the value of attribute failure.



97
98
99
# File 'lib/matcher.rb', line 97

def failure
  @failure
end

#outputObject

Returns the value of attribute output.



97
98
99
# File 'lib/matcher.rb', line 97

def output
  @output
end

Instance Method Details

#insert(char) ⇒ Object



106
107
108
109
# File 'lib/matcher.rb', line 106

def insert(char)
  @children[char] = Node.new unless @children.key?(char)
  @children[char]
end