Method: Filepath#==

Defined in:
lib/filepath/filepath.rb

#==(other) ⇒ boolean

Note:

this method compares the normalized versions of the paths

Checks whether two paths are equivalent.

Two paths are equivalent when they have the same normalized segments.

A relative and an absolute path will always be considered different. To compare relative paths to absolute path, expand first the relative path using Filepath::FilesystemInfo#absolute_path or Filepath::FilesystemInfo#real_path.

Examples:


path1 = "foo/bar".as_path
path2 = "foo/bar/baz".as_path
path3 = "foo/bar/baz/../../bar".as_path

path1 == path2            #=> false
path1 == path2.parent_dir #=> true
path1 == path3            #=> true

Parameters:

Returns:

  • (boolean)

    whether the other path is equivalent to the current path



648
649
650
# File 'lib/filepath/filepath.rb', line 648

def ==(other)
	return self.normalized_segments == other.as_path.normalized_segments
end