class Gamefic::Scanner::Result
The result of an attempt to scan objects against a token in a Scanner
. It provides an array of matching objects, the text that matched them, and the text that remains unmatched.
Attributes
match[R]
The matched objects
@return [Array<Entity>, String]
matched[R]
The matched objects
@return [Array<Entity>, String]
processor[R]
remainder[R]
The remaining (unmatched) portion of the token
@return [String]
scanned[R]
The scanned objects
@return [Array<Entity>, String
, Regexp]
token[R]
The scanned token
@return [String]
Public Class Methods
new(scanned, token, matched, remainder, processor)
click to toggle source
# File lib/gamefic/scanner/result.rb, line 33 def initialize scanned, token, matched, remainder, processor @scanned = scanned @token = token @matched = matched @remainder = remainder @processor = processor end
unmatched(scanned, token, processor)
click to toggle source
# File lib/gamefic/scanner/result.rb, line 55 def self.unmatched scanned, token, processor new(scanned, token, [], token, processor) end
Public Instance Methods
filter(*args)
click to toggle source
# File lib/gamefic/scanner/result.rb, line 45 def filter *args Scanner::Result.new( scanned, token, match.that_are(*args), remainder, processor ) end
strictness()
click to toggle source
# File lib/gamefic/scanner/result.rb, line 41 def strictness @strictness ||= Scanner.strictness(processor) end