Skip to content

Commit 684695a

Browse files
committed
Refactor AnnotateRoutes.remove_annotations and .strip_on_removal
1 parent 4b18038 commit 684695a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/annotate/annotate_routes.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ def remove_annotations(_options={})
3939
existing_text = File.read(routes_file)
4040
content, header_position = strip_annotations(existing_text)
4141
new_content = strip_on_removal(content, header_position)
42-
43-
# Make sure we end on a trailing newline.
44-
new_content << '' unless new_content.last == ''
4542
new_text = new_content.join("\n")
4643

4744
if rewrite_contents(existing_text, new_text)
@@ -150,6 +147,9 @@ def strip_on_removal(content, header_position)
150147
content.pop while content.last == ''
151148
end
152149

150+
# Make sure we end on a trailing newline.
151+
content << '' unless content.last == ''
152+
153153
# TODO: If the user buried it in the middle, we should probably see about
154154
# TODO: preserving a single line of space between the content above and
155155
# TODO: below...

0 commit comments

Comments
 (0)