class RBAhoCorasick::State

Attributes

data[RW]
default[RW]
state_id[R]

Public Class Methods

new(state_id) click to toggle source
# File lib/rbahocorasick/state.rb, line 9
def initialize(state_id)
  @transition = []
  @data = []
  @state_id = state_id
end

Public Instance Methods

==(o) click to toggle source
# File lib/rbahocorasick/state.rb, line 19
def ==(o)
  @state_id == o.state_id
end
[](input) click to toggle source
# File lib/rbahocorasick/state.rb, line 23
def [](input)
  @transition[input]
end
[]=(input, next_state) click to toggle source
# File lib/rbahocorasick/state.rb, line 27
def []=(input, next_state)
  @transition[input] and raise 'transition exists'
  @transition[input] = next_state
end
add(key, value) click to toggle source
# File lib/rbahocorasick/state.rb, line 15
def add(key, value)
  @data << RBAhoCorasick::StateData.new(key, value)
end