Class: RBS::CharScanner
- Inherits:
-
StringScanner
- Object
- StringScanner
- RBS::CharScanner
- Defined in:
- lib/rbs/char_scanner.rb
Instance Method Summary collapse
- #charpos ⇒ Object
-
#initialize(string) ⇒ CharScanner
constructor
A new instance of CharScanner.
- #original_charpos ⇒ Object
- #scan(pattern) ⇒ Object
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
#charpos ⇒ Object
10 11 12 |
# File 'lib/rbs/char_scanner.rb', line 10 def charpos @charpos end |
#original_charpos ⇒ Object
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 |