Class: MetaParse::FunctionMatcher
- Includes:
- MetaParse
- Defined in:
- lib/meta_parse.rb
Overview
Arbitrary predicate, particularly useful for generating final return value from SequentialMatchers. Context is the containing matcher, and in the case of SequentialMatcher includes access to accumulated matches.
Instance Attribute Summary
Attributes inherited from Matcher
Instance Method Summary collapse
Methods included from MetaParse
#all_matches, #all_matches_joined, #collapse, included, #join_strings, #parse_with_method
Methods inherited from Matcher
compile, #initialize, #inspect, #m, #m?, #match, #show, #stateful
Constructor Details
This class inherits a constructor from MetaParse::Matcher
Instance Method Details
#match?(scanner, context = nil) ⇒ Boolean
291 292 293 294 295 296 297 298 |
# File 'lib/meta_parse.rb', line 291 def match?(scanner, context=nil) case spec when Proc spec.call(scanner, context) when Symbol scanner.parser.send spec, scanner, context end end |