Class: Matchers::Node
- Inherits:
-
Object
- Object
- Matchers::Node
- Defined in:
- lib/matcher.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#failure ⇒ Object
Returns the value of attribute failure.
-
#output ⇒ Object
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize ⇒ Node
constructor
A new instance of Node.
- #insert(char) ⇒ Object
Constructor Details
#initialize ⇒ Node
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
#children ⇒ Object (readonly)
Returns the value of attribute children.
96 97 98 |
# File 'lib/matcher.rb', line 96 def children @children end |
#failure ⇒ Object
Returns the value of attribute failure.
97 98 99 |
# File 'lib/matcher.rb', line 97 def failure @failure end |
#output ⇒ Object
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 |