[#63592] [ruby-trunk - Bug #10009] IO operation is 10x slower in multi-thread environment — normalperson@...
Issue #10009 has been updated by Eric Wong.
3 messages
2014/07/08
[#63682] [ruby-trunk - Feature #10030] [PATCH] reduce rb_iseq_struct to 296 bytes — ko1@...
Issue #10030 has been updated by Koichi Sasada.
3 messages
2014/07/13
[#63703] [ruby-trunk - Feature #10030] [PATCH] reduce rb_iseq_struct to 296 bytes — ko1@...
Issue #10030 has been updated by Koichi Sasada.
3 messages
2014/07/14
[#63743] [ruby-trunk - Bug #10037] Since r46798 on Solaris, "[BUG] rb_vm_get_cref: unreachable" during make — ngotogenome@...
Issue #10037 has been updated by Naohisa Goto.
3 messages
2014/07/15
[#64136] Ruby 2.1.2 (and 2.1.1 and probably others) assumes a libffi with 3 version numbers in extconf.rb — "Jeffrey 'jf' Lim" <jfs.world@...>
As per subject.
4 messages
2014/07/31
[#64138] Re: Ruby 2.1.2 (and 2.1.1 and probably others) assumes a libffi with 3 version numbers in extconf.rb
— "Jeffrey 'jf' Lim" <jfs.world@...>
2014/07/31
On Thu, Jul 31, 2014 at 6:03 PM, Jeffrey 'jf' Lim <[email protected]>
[ruby-core:63644] [ruby-trunk - Bug #10011] Passing a string to Pathname#relative_path_from results in NoMethodError
From:
jacknagel@...
Date:
2014-07-10 23:48:11 UTC
List:
ruby-core #63644
Issue #10011 has been updated by Jack Nagel.
At the end of the day, I just want something more friendly than a `NoMethodError` from inside the method, so I won't stand in the way of progress, but...
>1. I didn't want to call Pathname::new if we already had been passed a Pathname (or class that inherits from that) - I think preserving the original subclass is important
I'm not sure how important that is in this case. This method only requires a Pathname so that it can call `cleanpath` on it, after which it is converted into a string. I guess someone may have overridden `cleanpath` in a subclass, but since calling it is just an implementation detail of `relative_path_from` I would argue that there is no expectation it will be called. Or am I missing a different reason?
>2. I wanted an nice exception, related to trying to create the Pathname, raise right at that point, to explain where the user had gone wrong.
I see your point, though I do think TypeError is more appropriate. And it would be consistent with, for example:
```ruby
File.rename "a", Object.new # => TypeError: no implicit conversion of Object into String
```
It seems ArgumentError is usually raised when there is something "wrong" with the argument (there are two examples in the body of `relative_path_from`) and TypeError when the incorrect type is passed.
----------------------------------------
Bug #10011: Passing a string to Pathname#relative_path_from results in NoMethodError
https://bugs.ruby-lang.org/issues/10011#change-47693
* Author: Jack Nagel
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
* ruby -v: ruby 2.2.0dev (2014-07-05 trunk 46706) [x86_64-darwin13]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
When a string is passed to Pathname#relative_path_from, a NoMethodError is raised.
```
irb(main):001:0> require "pathname"
=> true
irb(main):002:0> Pathname.new("/usr/bin/cc").relative_path_from Pathname.new("/usr/bin")
=> #<Pathname:cc>
irb(main):003:0> Pathname.new("/usr/bin/cc").relative_path_from("/usr/bin")
NoMethodError: undefined method `cleanpath' for "/usr/bin":String
from /Users/jacknagel/.rubies/ruby-2.2.0/lib/ruby/2.2.0/pathname.rb:493:in `relative_path_from'
from (irb):3
from /Users/jacknagel/.rubies/ruby-2.2.0/bin/irb:11:in `<main>'
```
I think either converting the argument to a Pathname or raising TypeError would be acceptable here.
--
https://bugs.ruby-lang.org/