mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* 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
This commit is contained in:
parent
a210f7c225
commit
391fc2eeec
4 changed files with 17 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue