Skip to content

Commit

Permalink
Auto corrected by following Lint Ruby Performance/ConstantRegexp
Browse files Browse the repository at this point in the history
  • Loading branch information
Awesome Code committed Jan 30, 2021
1 parent 22ecfa4 commit df40b57
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/synvert/core/engine/erb.rb
Expand Up @@ -31,20 +31,20 @@ def decode(source)
private

def decode_ruby_stmt(source)
source.gsub(/#{ERUBY_STMT_SPLITTER}(.+?)#{ERUBY_STMT_SPLITTER}/m) { "<%#{$1}%>" }
source.gsub(/#{ERUBY_STMT_SPLITTER}(.+?)#{ERUBY_STMT_SPLITTER}/mo) { "<%#{$1}%>" }
end

def decode_ruby_output(source)
source.gsub(/@output_buffer.append=\((.+?)\);#{ERUBY_EXPR_SPLITTER}/m) { "<%=#{$1}%>" }.gsub(
/@output_buffer.append= (.+?)\s+(do|\{)(\s*\|[^|]*\|)?\s*#{ERUBY_EXPR_SPLITTER}/m
source.gsub(/@output_buffer.append=\((.+?)\);#{ERUBY_EXPR_SPLITTER}/mo) { "<%=#{$1}%>" }.gsub(
/@output_buffer.append= (.+?)\s+(do|\{)(\s*\|[^|]*\|)?\s*#{ERUBY_EXPR_SPLITTER}/mo
) { |m| "<%=#{m.sub('@output_buffer.append= ', '').sub(ERUBY_EXPR_SPLITTER, '')}%>" }
end

def decode_html_output(source)
source.gsub(/@output_buffer.safe_append='(.+?)'.freeze;/m) { reverse_escape_text($1) }.gsub(
/@output_buffer.safe_append=\((.+?)\);#{ERUBY_EXPR_SPLITTER}/m
/@output_buffer.safe_append=\((.+?)\);#{ERUBY_EXPR_SPLITTER}/mo
) { reverse_escape_text($1) }.gsub(
/@output_buffer.safe_append=(.+?)\s+(do|\{)(\s*\|[^|]*\|)?\s*#{ERUBY_EXPR_SPLITTER}/m
/@output_buffer.safe_append=(.+?)\s+(do|\{)(\s*\|[^|]*\|)?\s*#{ERUBY_EXPR_SPLITTER}/mo
) { reverse_escape_text($1) }
end

Expand Down

0 comments on commit df40b57

Please sign in to comment.