Method: Pathname#existence

Defined in:
lib/pleasant_path/pathname.rb

#existenceself?

Returns the Pathname if exist? is true, otherwise returns nil.

Examples:

FileUtils.mkdir("dir1")
FileUtils.touch("dir1/file1")

Pathname.new("dir1/file1").existence  # == Pathname.new("dir1/file1")

Pathname.new("dir1/file2").existence  # == nil

Returns:

  • (self, nil)


54
55
56
# File 'lib/pleasant_path/pathname.rb', line 54

def existence
  self if self.exist?
end