Method: Path#rewrite

Defined in:
lib/path/io.rb

#rewrite {|contents| ... } ⇒ Object

Rewrites contents of self.

Path('file').rewrite { |contents| contents.reverse }

Yield Parameters:

  • contents (String)

Yield Returns:

  • (String)

    contents to write



85
86
87
# File 'lib/path/io.rb', line 85

def rewrite
  write yield read
end