Sha256: 004069c27f80601a492ee8f27d37dccd8e3937b5ed127d464371af760cf4aa5f

Contents?: true

Size: 419 Bytes

Versions: 12

Compression:

Stored size: 419 Bytes

Contents

require 'fileutils'

File.class_eval do
  def file_name
    File.basename path
  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
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ruby_ext-0.4.23 lib/ruby_ext/core/file.rb
ruby_ext-0.4.22 lib/ruby_ext/core/file.rb
ruby_ext-0.4.21 lib/ruby_ext/core/file.rb
ruby_ext-0.4.20 lib/ruby_ext/core/file.rb
ruby_ext-0.4.19 lib/ruby_ext/core/file.rb
ruby_ext-0.4.18 lib/ruby_ext/core/file.rb
ruby_ext-0.4.17 lib/ruby_ext/core/file.rb
ruby_ext-0.4.16 lib/ruby_ext/core/file.rb
ruby_ext-0.4.15 lib/ruby_ext/core/file.rb
ruby_ext-0.4.14 lib/ruby_ext/core/file.rb
ruby_ext-0.4.13 lib/ruby_ext/core/file.rb
ruby_ext-0.4.12 lib/ruby_ext/core/file.rb