Method: Pathname#make_file

Defined in:
lib/pleasant_path/pathname.rb

#make_fileself

Creates the file indicated by the Pathname, including any necessary parent directories. Returns the Pathname.

Examples:

Dir.exist?("path")                      # == false
Dir.exist?("path/to")                   # == false

Pathname.new("path/to/file").make_file  # == Pathname.new("path/to/file")

Dir.exist?("path")                      # == true
Dir.exist?("path/to")                   # == true
File.exist?("path/to/file")             # == true

Returns:

  • (self)

Raises:

  • (SystemCallError)

    if the Pathname points to an existing directory, or if any element of the dirname points to an existing file (non-directory)



335
336
337
338
# File 'lib/pleasant_path/pathname.rb', line 335

def make_file
  self.make_dirname.open("a"){}
  self
end