aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-20 06:37:53 +0000
committerzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-20 06:37:53 +0000
commitb6161a3bad879003b85aca13b637fb1fda5070e3 (patch)
tree0e107c050e4a082a5a907d9e8e20fd3c486d0a7c
parent134d33b0613093d338870a53328f156bcbf50f06 (diff)
downloadruby-b6161a3bad879003b85aca13b637fb1fda5070e3.tar.gz
* file.c (File.extname): Documentation for extname on dotfiles and
files ending with a dot. Also, added example for this. [ruby-core:47852] [Bug #7112] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--file.c11
2 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3c629f5853..a6562b07ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Nov 20 15:20:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * file.c (File.extname): Documentation for extname on dotfiles and
+ files ending with a dot. Also, added example for this.
+ [ruby-core:47852] [Bug #7112]
+
Tue Nov 20 14:19:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* test/ruby/test_signal.rb (TestSignal#test_signame): fix windows
diff --git a/file.c b/file.c
index eb70914b1a..7e2a8222fa 100644
--- a/file.c
+++ b/file.c
@@ -3850,11 +3850,18 @@ ruby_enc_find_extname(const char *name, long *len, rb_encoding *enc)
* call-seq:
* File.extname(path) -> string
*
- * Returns the extension (the portion of file name in <i>path</i>
- * after the period).
+ * Returns the extension (the portion of file name in +path+
+ * starting from the last period).
+ *
+ * If +path+ is a dotfile, or starts with a period, then only an empty string
+ * will be returned.
+ *
+ * An empty string will also be returned when the period is the last character
+ * in +path+.
*
* File.extname("test.rb") #=> ".rb"
* File.extname("a/b/d/test.rb") #=> ".rb"
+ * File.extname("foo.") #=> ""
* File.extname("test") #=> ""
* File.extname(".profile") #=> ""
*