diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-05 12:49:27 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-05 12:49:27 +0000 |
commit | 391fc2eeecfc2f0d0f851b0c27ba02e041fe2cd9 (patch) | |
tree | b51b61bc0abb0a66988b84f10eaf5e6f839661c3 /ext/pathname | |
parent | a210f7c225b0328ac16748c21e68c28f2236454e (diff) |
* ext/pathname/lib/pathname.rb (Pathname#/): Aliased to Pathname#+.
Suggested by Alexey Muranov. [ruby-core:61432] [Feature #9625]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/pathname')
-rw-r--r-- | ext/pathname/lib/pathname.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb index aa9464799d..380e740399 100644 --- a/ext/pathname/lib/pathname.rb +++ b/ext/pathname/lib/pathname.rb @@ -324,12 +324,17 @@ class Pathname # p2 = p1 + "bin/ruby" # Pathname:/usr/bin/ruby # p3 = p1 + "/etc/passwd" # Pathname:/etc/passwd # + # # / is aliased to +. + # p4 = p1 / "bin/ruby" # Pathname:/usr/bin/ruby + # p5 = p1 / "/etc/passwd" # Pathname:/etc/passwd + # # This method doesn't access the file system; it is pure string manipulation. # def +(other) other = Pathname.new(other) unless Pathname === other Pathname.new(plus(@path, other.to_s)) end + alias / + def plus(path1, path2) # -> path # :nodoc: prefix2 = path2 |