class Gamefic::Scanner::Strict
Strict
token matching.
An entity will only match a word in a strict scan if the entire word matches one of the entity’s keywords.
Public Instance Methods
match_word(available, word)
click to toggle source
# File lib/gamefic/scanner/strict.rb, line 26 def match_word available, word available.select { |obj| obj.keywords.include?(word) } end
scan()
click to toggle source
@return [Result]
# File lib/gamefic/scanner/strict.rb, line 12 def scan words = token.keywords available = selection.clone filtered = [] words.each_with_index do |word, idx| tested = match_word(available, word) return matched_result(filtered, words[idx..].join(' ')) if tested.empty? filtered = tested available = filtered end matched_result filtered, '' end