Project

General

Profile

Actions

Feature #20676

closed

Pathnames aren't Comparable

Added by gmcgibbon (Gannon McGibbon) 19 days ago. Updated 18 days ago.

Status:
Feedback
Assignee:
-
Target version:
-
[ruby-core:118844]

Description

👋

I was working with Pathnames recently and noticed that I could do:


Pathname("/a/b").to_s <= Pathname("/a/b/c").to_s

but could not do:

Pathname("/a/b") <= Pathname("/a/b/c")

to check if pathnames are subdirectories of each other.

Pathname implements <=> with case insensitive matching for use-cases like this, but does not include Comparable. I think Pathname should include Comparable. I've opened a PR here for your consideration.

Thanks!

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0