Class: StrScanParserR
Overview
:nodoc:
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(scanner) ⇒ StrScanParserR
constructor
A new instance of StrScanParserR.
- #match(regex, &block) ⇒ Object
- #rest ⇒ Object
- #rest? ⇒ Boolean
Constructor Details
#initialize(scanner) ⇒ StrScanParserR
Returns a new instance of StrScanParserR.
2 3 4 |
# File 'lib/web/strscanparser.rb', line 2 def initialize scanner @scanner = scanner end |
Instance Method Details
#match(regex, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/web/strscanparser.rb', line 6 def match regex, &block if s = @scanner.scan(regex) # $stderr.puts "got: #{s}" yield @scanner if block s else # $stderr.puts "tried #{regex.source} on: #{@scanner.rest}" nil end end |
#rest ⇒ Object
21 22 23 |
# File 'lib/web/strscanparser.rb', line 21 def rest @scanner.rest end |
#rest? ⇒ Boolean
17 18 19 |
# File 'lib/web/strscanparser.rb', line 17 def rest? @scanner.rest? end |