Class: StrScanParserR

Inherits:
Object show all
Defined in:
lib/web/strscanparser.rb

Overview

:nodoc:

Direct Known Subclasses

StrScanParser

Instance Method Summary collapse

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

#restObject



21
22
23
# File 'lib/web/strscanparser.rb', line 21

def rest
	@scanner.rest
end

#rest?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/web/strscanparser.rb', line 17

def rest?
	@scanner.rest?
end