Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor AnnotateRoutes::AnnotationProcessor#annotate_routes
  • Loading branch information
nard-tech committed Feb 9, 2024
commit dd1a53e5b95d76c7d7d424de7542354895b6f621
6 changes: 3 additions & 3 deletions lib/annotate/annotate_routes/annotation_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ module AnnotateRoutes
class AnnotationProcessor < BaseProcessor
# @return [Boolean]
def update
header = HeaderGenerator.generate(options)
content, header_position = strip_annotations(existing_text)
new_content = annotate_routes(header, content, header_position)
new_content = annotate_routes(content, header_position)
new_text = new_content.join("\n")
rewrite_contents(new_text)
end

private

def annotate_routes(header, content, header_position)
def annotate_routes(content, header_position)
header = HeaderGenerator.generate(options)
magic_comments_map, content = Helpers.extract_magic_comments_from_array(content)
if %w[before top].include?(options[:position_in_routes])
header = header << '' if content.first != ''
Expand Down