Actions
Bug #10011
closedPassing a string to Pathname#relative_path_from results in NoMethodError
Description
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.
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0