[#97086] [Ruby master Bug#16612] Enumerator::ArithmeticSequence#last with float range produces incorrect value — muraken@...
Issue #16612 has been updated by mrkn (Kenta Murata).
4 messages
2020/02/07
[#97307] [Ruby master Feature#16663] Add block or filtered forms of Kernel#caller to allow early bail-out — headius@...
Issue #16663 has been reported by headius (Charles Nutter).
29 messages
2020/02/28
[ruby-core:97187] [Ruby master Bug#14891] Pathname#join has different behaviour to File.join
From:
me@...
Date:
2020-02-18 07:58:11 UTC
List:
ruby-core #97187
Issue #14891 has been updated by jnchito (Junichi Ito).
I am wondering about the current behavior of Pathname#join, too. Are there any useful use cases for `Pathname.new('/a').join('/c', '/b').to_s #=> "/b"`? I think it should be `Pathname.new('/a').join('/c', '/b').to_s #=> "/a/c/b` like File#join. I'd like to know the basic idea behind this design.
----------------------------------------
Bug #14891: Pathname#join has different behaviour to File.join
https://bugs.ruby-lang.org/issues/14891#change-84295
* Author: robotdana (Dana Sherson)
* Status: Open
* Priority: Normal
* ruby -v: 2.6.0-preview2, and before
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
~~~ ruby
Pathname.new('/a').join('/b').to_s
# => "/b"
File.join(Pathname.new('/a'), '/b').to_s
# => "/a/b"
~~~
in my case `'/b'` was in a variable and it wasn't immediately obvious why it wasn't working when I moved to use Pathname
This seems to not be desired behaviour as it's different to `File.join`, and this case isn't document anywhere.
Can we either change the behaviour to treat the "other" of `Pathname#+` as always relative (possibly just removing a leading slash), or add this case to the documentation?
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>