lib/ruby_ext/file.rb in ruby-ext-0.2.16 vs lib/ruby_ext/file.rb in ruby-ext-0.4.0

- old
+ new

@@ -1,31 +1,20 @@ require 'fileutils' File.class_eval do - class << self - - # There is similar methods in ActiveSupport, that takes also second paramether buffer - # these methods 'as is' will broken rails app with passenger in production. - # - # def write(path, data) - # File.open(path, "wb") do |file| - # return file.write(data) - # end - # end - # - # def read(path) - # File.open(path, "rb") do |file| - # return file.read - # end - # end + class << self + def write(path, data) + File.open(path, "wb") do |file| + return file.write(data) + end + end - - def create_directory dir - FileUtils.mkdir_p dir unless File.exist? dir - end - - def delete_directory dir - FileUtils.rm_r dir, :force => true if File.exist? dir - end - end + def create_directory dir + FileUtils.mkdir_p dir unless File.exist? dir + end + + def delete_directory dir + FileUtils.rm_r dir, :force => true if File.exist? dir + end + end end \ No newline at end of file