Sha256: fbbbe919381a17697f116ea228476dd1e98c366c0a98708ab54610e7656b500a
Contents?: true
Size: 340 Bytes
Versions: 2
Compression:
Stored size: 340 Bytes
Contents
module FileMutate module OverwriteContent def overwrite content=nil, &block File.overwrite self.path, content, &block end module ClassMethods def overwrite file, content=nil, &block File.open(get_filepath(file).path, 'w') do |f| f.puts content ||= yield end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
file_mutate-0.1.3 | lib/file_mutate/overwrite_content.rb |
file_mutate-0.1.2 | lib/file_mutate/overwrite_content.rb |