Method: Enumerable#write_to_file
- Defined in:
- lib/pleasant_path/enumerable.rb
#write_to_file(file, eol: $/) ⇒ self
Writes each object in the Enumerable as a string plus eol
(end-of-line) characters to the specified file, overwriting the
file if it exists. Creates the file if it does not exist, including
any necessary parent directories. Returns the Enumerable.
17 18 19 20 |
# File 'lib/pleasant_path/enumerable.rb', line 17 def write_to_file(file, eol: $/) file.to_pathname.write_lines(self, eol: eol) self end |