Module: Gamefic::Scanner
- Defined in:
- lib/gamefic/scanner.rb
Overview
A module for matching objects to tokens.
Defined Under Namespace
Classes: Result
Constant Summary collapse
- NEST_REGEXP =
/ in | on | of | from | inside | from inside /
Class Method Summary collapse
- .fuzzy(selection, token) ⇒ Result
-
.scan(selection, token) ⇒ Result
Scan entities against a token.
- .strict(selection, token) ⇒ Result
Class Method Details
.fuzzy(selection, token) ⇒ Result
64 65 66 67 68 |
# File 'lib/gamefic/scanner.rb', line 64 def self.fuzzy selection, token return scan_text(selection, token) unless selection.is_a?(Array) scan_strict_or_fuzzy(selection, token, :select_fuzzy) end |
.scan(selection, token) ⇒ Result
Scan entities against a token.
47 48 49 50 |
# File 'lib/gamefic/scanner.rb', line 47 def self.scan selection, token strict_result = strict(selection, token) strict_result.matched.empty? ? fuzzy(selection, token) : strict_result end |