It's possible for a Ruby file to be empty and thus `gets` returns `nil`. Also indents the Markdown since we're using `<<~` and removes an unneeded variable.
Checks that new Ruby files will enable frozen string literal. Partially addresses #47424.