Actions
Misc #19155
closeddocumentation of Pathname#join with absolute path
Misc #19155:
documentation of Pathname#join with absolute path
Status:
Closed
Assignee:
-
Description
Pathname#join ignores previous directory name before absolute path
Is this intentional?
irb(main):002:0> require 'pathname'
=> true
irb(main):003:0> Pathname('/foo').join('bar', 'baz')
=> #<Pathname:/foo/bar/baz>
irb(main):004:0> Pathname('/foo').join('bar', '/baz')
=> #<Pathname:/baz>
irb(main):005:0>
➜✗ ruby -v
ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-darwin19]
I found that this behavior is intentional from test code but I cannot found reason.
https://github.com/ruby/pathname/blob/master/test/pathname/test_pathname.rb#L248-L261
There was no description of this behavior in the documentation.
Actions