Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Pathname#==

(untyped) -> bool
self == other → true or false

Returns whether the stored paths in self and other are equal:

Example
pn = Pathname('lib')
pn == Pathname('lib')   # => true
pn == Pathname('./lib') # => false

Returns false if other is not a pathname:

Example
pn == 'lib'             # => false
See also #<=> #=== #/ #absolute? also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0