Class: Array
Instance Method Summary collapse
-
#append_to_file(file) ⇒ Array
Appends the array as lines to the given file, and returns the array.
-
#write_to_file(file) ⇒ Array
Writes the array as lines to the given file, and returns the array.
Instance Method Details
#append_to_file(file) ⇒ Array
Appends the array as lines to the given file, and returns the array. A new line character ($/) is written after each line. The file is created if it does not exist. Any necessary parent directories are created if they do not exist.
32 33 34 35 |
# File 'lib/pleasant_path/array.rb', line 32 def append_to_file(file) file.to_pathname.append_lines(self) self end |
#write_to_file(file) ⇒ Array
Writes the array as lines to the given file, and returns the array. A new line character ($/) is written after each line. The file is overwritten if it already exists. Any necessary parent directories are created if they do not exist.
14 15 16 17 |
# File 'lib/pleasant_path/array.rb', line 14 def write_to_file(file) file.to_pathname.write_lines(self) self end |