diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-18 03:09:54 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-18 03:09:54 +0000 |
commit | 78dc3da299f49eec2783190ad72812852750f40e (patch) | |
tree | 61337a349ba6dc71369b3ef0baa3f292b9ae1d37 /ext | |
parent | 623c6d972a5365f469d4ceb0fc3326faf35ba7b6 (diff) | |
download | ruby-78dc3da299f49eec2783190ad72812852750f40e.tar.gz |
Pathname#relative_path_from uses is_a?
I reconsidered because simpler code would have better maintainablity.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/pathname/lib/pathname.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb index 383d47b52f..2fd0642e14 100644 --- a/ext/pathname/lib/pathname.rb +++ b/ext/pathname/lib/pathname.rb @@ -503,13 +503,9 @@ class Pathname # ArgumentError is raised when it cannot find a relative path. # def relative_path_from(base_directory) + base_directory = Pathname.new(base_directory) unless base_directory.is_a? Pathname dest_directory = self.cleanpath.to_s - base_directory = - if base_directory.respond_to? :cleanpath - base_directory - else - Pathname.new(base_directory) - end.cleanpath.to_s + base_directory = base_directory.cleanpath.to_s dest_prefix = dest_directory dest_names = [] while r = chop_basename(dest_prefix) |