diff options
author | makoto kuwata <kwa@kuwata-lab.com> | 2009-07-14 10:05:11 +0900 |
---|---|---|
committer | makoto kuwata <kwa@kuwata-lab.com> | 2009-07-14 10:05:11 +0900 |
commit | 899968ed398fdec00903fab59f1ed36c55b4f20b (patch) | |
tree | b978f9e0e09125a6d521d79c33282235a4bb34ea /lib | |
parent | 3bad74be554caaa34527e7407138d4840a71c4f1 (diff) | |
download | erubis-899968ed398fdec00903fab59f1ed36c55b4f20b.tar.gz |
[refactor] tiny.rb to use 'pos...m.begin(0)' instead of 'input[pos, match.begin(0) - pos]'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/erubis/tiny.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/erubis/tiny.rb b/lib/erubis/tiny.rb index 8f925a1..3eb9547 100644 --- a/lib/erubis/tiny.rb +++ b/lib/erubis/tiny.rb @@ -27,10 +27,9 @@ module Erubis src = "_buf = '';" # preamble pos = 0 input.scan(EMBEDDED_PATTERN) do |indicator, code| - match = Regexp.last_match - len = match.begin(0) - pos - text = input[pos, len] - pos = match.end(0) + m = Regexp.last_match + text = input[pos...m.begin(0)] + pos = m.end(0) #src << " _buf << '" << escape_text(text) << "';" text.gsub!(/['\\]/, '\\\\\&') src << " _buf << '" << text << "';" unless text.empty? |