@@ -31,18 +31,18 @@ def decode(source)
31
31
private
32
32
33
33
def decode_ruby_stmt ( source )
34
- source . gsub ( /#{ ERUBY_STMT_SPLITTER } (.+?)#{ ERUBY_STMT_SPLITTER } /m ) { "<%#{ $1 } %>" }
34
+ source . gsub ( /#{ ERUBY_STMT_SPLITTER } (.+?)#{ ERUBY_STMT_SPLITTER } /m ) { "<%#{ Regexp . last_match ( 1 ) } %>" }
35
35
end
36
36
37
37
def decode_ruby_output ( source )
38
- source . gsub ( /@output_buffer.append=\( (.+?)\) ;#{ ERUBY_EXPR_SPLITTER } /m ) { "<%=#{ $1 } %>" }
38
+ source . gsub ( /@output_buffer.append=\( (.+?)\) ;#{ ERUBY_EXPR_SPLITTER } /m ) { "<%=#{ Regexp . last_match ( 1 ) } %>" }
39
39
. gsub ( /@output_buffer.append= (.+?)\s +(do|\{ )(\s *\| [^|]*\| )?\s *#{ ERUBY_EXPR_SPLITTER } /m ) { |m | "<%=#{ m . sub ( "@output_buffer.append= " , "" ) . sub ( ERUBY_EXPR_SPLITTER , "" ) } %>" }
40
40
end
41
41
42
42
def decode_html_output ( source )
43
- source . gsub ( /@output_buffer.safe_append='(.+?)'.freeze;/m ) { reverse_escape_text ( $1 ) }
44
- . gsub ( /@output_buffer.safe_append=\( (.+?)\) ;#{ ERUBY_EXPR_SPLITTER } /m ) { reverse_escape_text ( $1 ) }
45
- . gsub ( /@output_buffer.safe_append=(.+?)\s +(do|\{ )(\s *\| [^|]*\| )?\s *#{ ERUBY_EXPR_SPLITTER } /m ) { reverse_escape_text ( $1 ) }
43
+ source . gsub ( /@output_buffer.safe_append='(.+?)'.freeze;/m ) { reverse_escape_text ( Regexp . last_match ( 1 ) ) }
44
+ . gsub ( /@output_buffer.safe_append=\( (.+?)\) ;#{ ERUBY_EXPR_SPLITTER } /m ) { reverse_escape_text ( Regexp . last_match ( 1 ) ) }
45
+ . gsub ( /@output_buffer.safe_append=(.+?)\s +(do|\{ )(\s *\| [^|]*\| )?\s *#{ ERUBY_EXPR_SPLITTER } /m ) { reverse_escape_text ( Regexp . last_match ( 1 ) ) }
46
46
end
47
47
48
48
def remove_erubis_buf ( source )
@@ -112,9 +112,9 @@ def add_stmt(src, code)
112
112
flush_newline_if_pending ( src )
113
113
if code != "\n " && code != ""
114
114
index = if code =~ /\A (\s *)\r ?\n /
115
- $1 . length
115
+ Regexp . last_match ( 1 ) . length
116
116
elsif code =~ /\A (\s +)/
117
- $1 . end_with? ( ' ' ) ? $1 . length - 1 : $1 . length
117
+ Regexp . last_match ( 1 ) . end_with? ( ' ' ) ? Regexp . last_match ( 1 ) . length - 1 : Regexp . last_match ( 1 ) . length
118
118
else
119
119
0
120
120
end
0 commit comments