Sha256: 9a39a7a56fd048656f1cb05a02c4309b6deaff5b5f4ee3840d305c20e889c721
Contents?: true
Size: 862 Bytes
Versions: 2
Compression:
Stored size: 862 Bytes
Contents
require 'module_extensions' # == Synopsis # Various extensions to the File class # Note, uses the Module.my_extension method to only add the method if # it doesn't already exist. class File class << self my_extension("mkdirs") do # == Synopsis # make directories including any missing in the path # # @param [String] dirspec the path to make sure exists def File.mkdirs(dirspec) unless File.exists?(dirspec) mkdirs(File.dirname(dirspec)) Dir.mkdir(dirspec) end end end my_extension("touch") do # == Synopsis # Sets the last modification time of the given filespec # to the current time. Create the given file if it doesn't # exist require 'fileutils' def File.touch(filespec) FileUtils.touch(filespec) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
royw-roys_extensions-0.0.3 | lib/file_extensions.rb |
royw-roys_extensions-0.0.4 | lib/file_extensions.rb |