Class: RBS::CharScanner

Inherits:
StringScanner
  • Object
show all
Defined in:
lib/rbs/char_scanner.rb

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ CharScanner

Returns a new instance of CharScanner.



3
4
5
6
# File 'lib/rbs/char_scanner.rb', line 3

def initialize(string)
  super(string)
  @charpos = 0
end

Instance Method Details

#charposObject



10
11
12
# File 'lib/rbs/char_scanner.rb', line 10

def charpos
  @charpos
end

#original_charposObject



8
# File 'lib/rbs/char_scanner.rb', line 8

alias original_charpos charpos

#scan(pattern) ⇒ Object



14
15
16
17
18
# File 'lib/rbs/char_scanner.rb', line 14

def scan(pattern)
  s = super
  @charpos += s.size if s
  s
end