[前][次][番号順一覧][スレッド一覧]

ruby-changes:25692

From: zzak <ko1@a...>
Date: Tue, 20 Nov 2012 15:38:35 +0900 (JST)
Subject: [ruby-changes:25692] zzak:r37749 (trunk): * file.c (File.extname): Documentation for extname on dotfiles and

zzak	2012-11-20 15:37:53 +0900 (Tue, 20 Nov 2012)

  New Revision: 37749

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37749

  Log:
    * 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]

  Modified files:
    trunk/ChangeLog
    trunk/file.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37748)
+++ ChangeLog	(revision 37749)
@@ -1,3 +1,9 @@
+Tue Nov 20 15:20:00 2012  Zachary Scott  <zachary@z...>
+
+	* 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@g...>
 
 	* test/ruby/test_signal.rb (TestSignal#test_signame): fix windows
Index: file.c
===================================================================
--- file.c	(revision 37748)
+++ file.c	(revision 37749)
@@ -3850,11 +3850,18 @@
  *  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")        #=> ""
  *

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]