Module: FileMutate::OverwriteContent::ClassMethods

Defined in:
lib/file_mutate/overwrite_content.rb

Instance Method Summary collapse

Instance Method Details

#overwrite(file, content = nil, &block) ⇒ Object



8
9
10
11
12
# File 'lib/file_mutate/overwrite_content.rb', line 8

def overwrite file, content=nil, &block
  File.open(get_filepath(file).path, 'w') do |f|
    f.puts content ||= yield
  end
end