File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,12 @@ def remove_annotations(_options={})
39
39
existing_text = File . read ( routes_file )
40
40
content , header_position = strip_annotations ( existing_text )
41
41
new_content = strip_on_removal ( content , header_position )
42
- if rewrite_contents ( existing_text , new_content )
42
+
43
+ # Make sure we end on a trailing newline.
44
+ new_content << '' unless new_content . last == ''
45
+ new_text = new_content . join ( "\n " )
46
+
47
+ if rewrite_contents ( existing_text , new_text )
43
48
puts "Removed annotations from #{ routes_file } ."
44
49
end
45
50
end
@@ -152,11 +157,7 @@ def strip_on_removal(content, header_position)
152
157
end
153
158
154
159
# @param [String, Array<String>]
155
- def rewrite_contents ( existing_text , new_content )
156
- # Make sure we end on a trailing newline.
157
- new_content << '' unless new_content . last == ''
158
- new_text = new_content . join ( "\n " )
159
-
160
+ def rewrite_contents ( existing_text , new_text )
160
161
if existing_text == new_text
161
162
puts "#{ routes_file } unchanged."
162
163
false
You can’t perform that action at this time.
0 commit comments