Skip to content

Commit a15c1f5

Browse files
committed
Define Pathname#<=> only if the C extension is not loaded
1 parent c8c2210 commit a15c1f5

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/pathname.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,12 @@ def ==(other)
252252
alias === ==
253253
alias eql? ==
254254

255-
# Provides for comparing pathnames, case-sensitively.
256-
def <=>(other)
257-
return nil unless Pathname === other
258-
@path.tr('/', "\0") <=> other.to_s.tr('/', "\0")
255+
unless method_defined?(:<=>)
256+
# Provides for comparing pathnames, case-sensitively.
257+
def <=>(other)
258+
return nil unless Pathname === other
259+
@path.tr('/', "\0") <=> other.to_s.tr('/', "\0")
260+
end
259261
end
260262

261263
def hash # :nodoc:

0 commit comments

Comments
 (0)