Class: Gamefic::Scanner::Nesting

Inherits:
Base
  • Object
show all
Defined in:
lib/gamefic/scanner/nesting.rb

Overview

Strict scanning for entities inside of other entities, e.g., ‘sock inside drawer`.

Direct Known Subclasses

FuzzyNesting

Constant Summary collapse

NEST_REGEXP =
/ in | on | of | from | inside | inside of | from inside | off | out | out of /.freeze

Instance Attribute Summary

Attributes inherited from Base

#selection, #token

Instance Method Summary collapse

Methods inherited from Base

#initialize, scan

Constructor Details

This class inherits a constructor from Gamefic::Scanner::Base

Instance Method Details

#scanObject



14
15
16
17
18
# File 'lib/gamefic/scanner/nesting.rb', line 14

def scan
  return unmatched_result unless token =~ NEST_REGEXP

  denest selection, token
end

#subprocessorObject



10
11
12
# File 'lib/gamefic/scanner/nesting.rb', line 10

def subprocessor
  Strict
end