Walter Lee Davis
2018-07-19 18:50:29 UTC
This difference was surprising to me:
irb (2.4.4)
require ‘pathname’
Pathname.new(‘foo’).join(‘/bar’)
=> #<Pathname:/bar>
Pathname.new(‘foo’).join(‘bar’)
=> #<Pathname:foo/bar>
File.join(‘foo’, ‘/bar’)
=> “foo/bar”
File.join(‘foo’, ‘bar’)
=> “foo/bar”
Is there a reasonable explanation that I can’t think of for this behavior?
Walter
Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/r
irb (2.4.4)
require ‘pathname’
Pathname.new(‘foo’).join(‘/bar’)
=> #<Pathname:/bar>
Pathname.new(‘foo’).join(‘bar’)
=> #<Pathname:foo/bar>
File.join(‘foo’, ‘/bar’)
=> “foo/bar”
File.join(‘foo’, ‘bar’)
=> “foo/bar”
Is there a reasonable explanation that I can’t think of for this behavior?
Walter
Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/r