From ffa3e17f8b918f8614964e52a54a4c2a2c65a714 Mon Sep 17 00:00:00 2001 From: Francesco Aiello Date: Fri, 31 Mar 2023 10:19:27 -0700 Subject: [PATCH] Remove unused format_erb_attributes method Co-authored-by: Elia Schito --- lib/erb/formatter.rb | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/lib/erb/formatter.rb b/lib/erb/formatter.rb index 2f57a87..b4d49c4 100644 --- a/lib/erb/formatter.rb +++ b/lib/erb/formatter.rb @@ -146,45 +146,6 @@ def format_attributes(tag_name, attrs, tag_closing) attr_html end - def format_erb_attributes(string) - erb_scanner = StringScanner.new(string.to_s) - erb_pre_pos = 0 - until erb_scanner.eos? - if erb_scanner.scan_until(erb_tags_regexp) - erb_pre_match = erb_scanner.pre_match - erb_pre_match = erb_pre_match[erb_pre_pos..] - erb_pre_pos = erb_scanner.pos - - erb_code = erb_tags[erb_scanner.captures.first] - - format_attributes(erb_pre_match) - - erb_open, ruby_code, erb_close = ERB_TAG.match(erb_code).captures - full_erb_tag = "#{erb_open} #{ruby_code} #{erb_close}" - - case ruby_code - when /\Aend\z/ - tag_stack_pop('%erb%', ruby_code) - html << (erb_pre_match.match?(/\s+\z/) ? indented(full_erb_tag) : full_erb_tag) - when /\A(else|elsif\b(.*))\z/ - tag_stack_pop('%erb%', ruby_code) - html << (erb_pre_match.match?(/\s+\z/) ? indented(full_erb_tag) : full_erb_tag) - tag_stack_push('%erb%', ruby_code) - when RUBY_OPEN_BLOCK - html << (erb_pre_match.match?(/\s+\z/) ? indented(full_erb_tag) : full_erb_tag) - tag_stack_push('%erb%', ruby_code) - else - ruby_code = format_ruby(ruby_code, autoclose: false) - html << (erb_pre_match.match?(/\s+\z/) ? indented(full_erb_tag) : full_erb_tag) - end - else - rest = erb_scanner.rest.to_s - format_erb_attributes(rest) - erb_scanner.terminate - end - end - end - def tag_stack_push(tag_name, code) tag_stack << [tag_name, code] p PUSH: tag_stack if @debug