class File 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 def create_directory dir Dir.mkdir dir unless File.exist? dir end def delete_directory dir FileUtils.rm_r dir, :force => true if File.exist? dir end end end