summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-07 02:08:04 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-07 02:08:04 +0000
commit83927c56aa3d8de1a631616d0e30cfec24315998 (patch)
treea644aeccd0d12dccbf48b29d50780afd22341432
parent2e1cb2096c9d98a16cd3893fbc5af751caffda43 (diff)
downloadruby-83927c56aa3d8de1a631616d0e30cfec24315998.tar.gz
ruby-83927c56aa3d8de1a631616d0e30cfec24315998.tar.xz
ruby-83927c56aa3d8de1a631616d0e30cfec24315998.zip
* lib/pathname.rb (Pathname#+): return the argument if self is `.'.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--lib/pathname.rb6
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index bdb47e2e1..e76c497e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Nov 7 11:06:57 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb (Pathname#+): return the argument if self is `.'.
+
Fri Nov 7 10:23:24 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/socket/socket.c (make_hostent): get rid of SEGV on aliases
diff --git a/lib/pathname.rb b/lib/pathname.rb
index b4462bfea..c433f5dff 100644
--- a/lib/pathname.rb
+++ b/lib/pathname.rb
@@ -213,10 +213,12 @@ class Pathname
# Pathname#+ return new pathname which is concatenated with self and
# an argument.
- # If the argument is absolute pathname, it is just returned.
+ # If self is the current working directory `.' or
+ # the argument is absolute pathname,
+ # the argument is just returned.
def +(other)
other = Pathname.new(other) unless Pathname === other
- if other.absolute?
+ if @path == '.' || other.absolute?
other
elsif %r{/\z} =~ @path
Pathname.new(@path + other.to_s)