Method: Pathname#edit_lines
- Defined in:
- lib/pleasant_path/pathname.rb
#edit_lines(eol: $/) {|lines| ... } ⇒ self
Reads the file indicated by the Pathname, and yields the entire contents as an Array of lines to the given block for editing. Writes the return value of the block back to the file, overwriting previous contents. eol
(end-of-line) characters are stripped from each line when reading, and appended to each line when writing. Returns the Pathname.
1086 1087 1088 1089 |
# File 'lib/pleasant_path/pathname.rb', line 1086 def edit_lines(eol: $/, &block) File.edit_lines(self, eol: eol, &block) self end |