Skip to content

Commit

Permalink
Don't use pattern matching because it's causing warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Oct 2, 2022
1 parent 8f5a88a commit db0454b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions actionview/lib/action_view/template/handlers/erb.rb
Expand Up @@ -139,10 +139,11 @@ def find_offset(compiled, source_tokens, error_column)
passed_tokens = []

while tok = source_tokens.shift
case tok
in [:TEXT, str]
tok_name, str = *tok
case tok_name
when :TEXT
raise unless compiled.scan(str)
in [:CODE, str]
when :CODE
raise "We went too far" if compiled.pos > error_column

if compiled.pos + str.bytesize >= error_column
Expand All @@ -151,13 +152,13 @@ def find_offset(compiled, source_tokens, error_column)
else
raise unless compiled.scan(str)
end
in [:OPEN, str]
when :OPEN
next_tok = source_tokens.first.last
loop do
break if compiled.match?(next_tok)
compiled.getch
end
in [:CLOSE, str]
when :CLOSE
next_tok = source_tokens.first.last
loop do
break if compiled.match?(next_tok)
Expand Down

0 comments on commit db0454b

Please sign in to comment.