@@ -31,21 +31,21 @@ 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 } %>" } . gsub (
38
+ source . gsub ( /@output_buffer.append=\( (.+?)\) ;#{ ERUBY_EXPR_SPLITTER } /m ) { "<%=#{ Regexp . last_match ( 1 ) } %>" } . gsub (
39
39
/@output_buffer.append= (.+?)\s +(do|\{ )(\s *\| [^|]*\| )?\s *#{ ERUBY_EXPR_SPLITTER } /m
40
40
) { |m | "<%=#{ m . sub ( '@output_buffer.append= ' , '' ) . sub ( ERUBY_EXPR_SPLITTER , '' ) } %>" }
41
41
end
42
42
43
43
def decode_html_output ( source )
44
- source . gsub ( /@output_buffer.safe_append='(.+?)'.freeze;/m ) { reverse_escape_text ( $1 ) } . gsub (
44
+ source . gsub ( /@output_buffer.safe_append='(.+?)'.freeze;/m ) { reverse_escape_text ( Regexp . last_match ( 1 ) ) } . gsub (
45
45
/@output_buffer.safe_append=\( (.+?)\) ;#{ ERUBY_EXPR_SPLITTER } /m
46
- ) { reverse_escape_text ( $1 ) } . gsub (
46
+ ) { reverse_escape_text ( Regexp . last_match ( 1 ) ) } . gsub (
47
47
/@output_buffer.safe_append=(.+?)\s +(do|\{ )(\s *\| [^|]*\| )?\s *#{ ERUBY_EXPR_SPLITTER } /m
48
- ) { reverse_escape_text ( $1 ) }
48
+ ) { reverse_escape_text ( Regexp . last_match ( 1 ) ) }
49
49
end
50
50
51
51
def remove_erubis_buf ( source )
@@ -119,9 +119,9 @@ def add_stmt(src, code)
119
119
index =
120
120
case code
121
121
when /\A (\s *)\r ?\n /
122
- $1 . length
122
+ Regexp . last_match ( 1 ) . length
123
123
when /\A (\s +)/
124
- $1 . end_with? ( ' ' ) ? $1 . length - 1 : $1 . length
124
+ Regexp . last_match ( 1 ) . end_with? ( ' ' ) ? Regexp . last_match ( 1 ) . length - 1 : Regexp . last_match ( 1 ) . length
125
125
else
126
126
0
127
127
end
0 commit comments