Skip to content

Instantly share code, notes, and snippets.

@rubychan
Created February 25, 2011 03:51
Show Gist options
  • Save rubychan/843336 to your computer and use it in GitHub Desktop.
Save rubychan/843336 to your computer and use it in GitHub Desktop.
diff --git a/lib/strscan.rb b/lib/strscan.rb
index 3908bfb..b2ac46c 100644
--- a/lib/strscan.rb
+++ b/lib/strscan.rb
@@ -161,7 +161,7 @@ class StringScanner
end
def rest
- @string[pos..-1]
+ @string.substring(@pos, rest_size)
end
def rest?
@@ -169,7 +169,7 @@ class StringScanner
end
def rest_size
- rest.size
+ @string.size - @pos
end
def restsize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment