Class: Matchers::Node

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNode

Returns a new instance of Node.



71
72
73
74
75
76
# File 'lib/aho_corasick.rb', line 71

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

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



68
69
70
# File 'lib/aho_corasick.rb', line 68

def children
  @children
end

#failureObject

Returns the value of attribute failure.



69
70
71
# File 'lib/aho_corasick.rb', line 69

def failure
  @failure
end

#outputObject

Returns the value of attribute output.



69
70
71
# File 'lib/aho_corasick.rb', line 69

def output
  @output
end

Instance Method Details

#insert(char) ⇒ Object



78
79
80
81
# File 'lib/aho_corasick.rb', line 78

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