class Attentive::Tokens::AnyOf
Attributes
possibilities[R]
Public Class Methods
new(string, possibilities, pos)
click to toggle source
Calls superclass method
Attentive::StringToken::new
# File lib/attentive/tokens/any_of.rb, line 8 def initialize(string, possibilities, pos) super string, pos @possibilities = possibilities end
Public Instance Methods
==(other)
click to toggle source
# File lib/attentive/tokens/any_of.rb, line 13 def ==(other) self.class == other.class && self.possibilities == other.possibilities end
ambiguous?()
click to toggle source
# File lib/attentive/tokens/any_of.rb, line 17 def ambiguous? true end
matches?(cursor)
click to toggle source
# File lib/attentive/tokens/any_of.rb, line 21 def matches?(cursor) possibilities.each do |phrase| cursor_copy = cursor.new_from_here match = Attentive::Matcher.new(phrase, cursor_copy).match! if match cursor.advance cursor_copy.pos return match.to_h end end false end