Class: RPStringScanner
- Inherits:
-
StringScanner
- Object
- StringScanner
- RPStringScanner
- Defined in:
- lib/rp_stringscanner.rb
Instance Method Summary collapse
- #d(o) ⇒ Object
- #getch ⇒ Object
- #old_getch ⇒ Object
- #old_scan ⇒ Object
- #scan(re) ⇒ Object
- #string_to_pos ⇒ Object
-
#unread_many(str) ⇒ Object
TODO: remove this entirely - we should not need it.
Instance Method Details
#d(o) ⇒ Object
60 61 62 |
# File 'lib/rp_stringscanner.rb', line 60 def d o $stderr.puts o.inspect end |
#getch ⇒ Object
45 46 47 48 49 |
# File 'lib/rp_stringscanner.rb', line 45 def getch c = self.old_getch p :getch => [c, caller.first] c end |
#old_getch ⇒ Object
44 |
# File 'lib/rp_stringscanner.rb', line 44 alias :old_getch :getch |
#old_scan ⇒ Object
51 |
# File 'lib/rp_stringscanner.rb', line 51 alias :old_scan :scan |
#scan(re) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/rp_stringscanner.rb', line 52 def scan re s = old_scan re where = caller[1].split(/:/).first(2).join(":") d :scan => [s, where] if s s end |
#string_to_pos ⇒ Object
14 15 16 |
# File 'lib/rp_stringscanner.rb', line 14 def string_to_pos string.byteslice(0, pos) end |
#unread_many(str) ⇒ Object
TODO: remove this entirely - we should not need it
34 35 36 37 38 39 40 41 |
# File 'lib/rp_stringscanner.rb', line 34 def unread_many str # TODO: remove this entirely - we should not need it warn({:unread_many => caller[0]}.inspect) if ENV['TALLY'] begin string[charpos, 0] = str rescue IndexError # HACK -- this is a bandaid on a dirty rag on an open festering wound end end |