lib/sugar-high/file.rb in sugar-high-0.2.4 vs lib/sugar-high/file.rb in sugar-high-0.2.5

- old
+ new

@@ -34,10 +34,11 @@ File.open(path, 'w+') do |f| f.puts content ||= yield end end - def self.remove_from file_name, content, &block + def self.remove_from file_name, content=nil, &block + content ||= yield replace_content_from file_name, :content => content, :with => '', &block end # replaces content found at replacement_expr with content resulting from yielding block # File.replace_content_from 'myfile.txt', where => /HelloWorld/, with => 'GoodBye'