lib/tapioca/commands/annotations.rb in tapioca-0.9.0 vs lib/tapioca/commands/annotations.rb in tapioca-0.9.1
- old
+ new
@@ -191,10 +191,11 @@
# DO NOT EDIT MANUALLY
# This file was pulled from a central RBI files repository.
# Please run `#{default_command(:annotations)}` to update it.
COMMENT
- contents = content.split("\n")
+ # Split contents into newlines and ensure trailing empty lines are included
+ contents = content.split("\n", -1)
if contents[0]&.start_with?("# typed:") && contents[1]&.empty?
contents.insert(2, header).join("\n")
else
say_error("Couldn't insert file header for content: #{content} due to unexpected file format")
content