Sha256: fb91e232755213fa57307dda72c70da9e7c75530840736b5ae5f82e50ae0b527

Contents?: true

Size: 672 Bytes

Versions: 3

Compression:

Stored size: 672 Bytes

Contents

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
    
    
		
		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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-ext-0.2.16 lib/ruby_ext/file.rb
ruby-ext-0.2.15 lib/ruby_ext/file.rb
ruby-ext-0.2.13 lib/ruby_ext/file.rb