diff options
author | Xavier Noria <fxn@hashref.com> | 2018-05-05 19:26:56 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2018-05-05 19:38:38 +0200 |
commit | be9a32b65ff5e72f54365e79338516d46063e069 (patch) | |
tree | 19f779b946bdfd675edc4153ee43e2e020a751bb /railties/.gitignore | |
parent | 42b9e7e50c084e119a679cf155b70b5efc4d36ff (diff) | |
download | rails-be9a32b65ff5e72f54365e79338516d46063e069.tar.gz rails-be9a32b65ff5e72f54365e79338516d46063e069.tar.bz2 rails-be9a32b65ff5e72f54365e79338516d46063e069.zip |
prefer File.write for bulk writes
I saw these ones while working on #32362.
File.write was introduced in Ruby 1.9.3 and it is the most concise way
to perform bulk writes (as File.read is for bulk reading).
The existing flags enabled binmode, but we are dumping text here.
The portable way to dump text is text mode. The only difference is
newlines, and portable code should in particular emit portable newlines.
Please note the hard-coded \ns are still correct. In languages with C
semantics for newlines like Ruby, Python, Perl, and others, "\n" is a
portable newline. Both when writing and when reading. On Windows, the
I/O layer is responsible for prepending a CR before each LF on writing,
and removing CRs followed by LFs on reading. On Unix, binmode is a
no-op.
Diffstat (limited to 'railties/.gitignore')
0 files changed, 0 insertions, 0 deletions