ruby-changes:47815
From: nobu <ko1@a...>
Date: Sat, 16 Sep 2017 20:51:01 +0900 (JST)
Subject: [ruby-changes:47815] nobu:r59933 (trunk): file.c: [DOC] separators at dirname and basename
nobu 2017-09-16 20:50:56 +0900 (Sat, 16 Sep 2017) New Revision: 59933 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59933 Log: file.c: [DOC] separators at dirname and basename * file.c (rb_file_s_basename, rb_file_s_dirname): [DOC] state that trailing separators will be stripped first, like as basename(1) and dirname(1). [ruby-core:82828] [Bug #13908] Modified files: trunk/file.c Index: file.c =================================================================== --- file.c (revision 59932) +++ file.c (revision 59933) @@ -4121,7 +4121,8 @@ ruby_enc_find_basename(const char *name, https://github.com/ruby/ruby/blob/trunk/file.c#L4121 * call-seq: * File.basename(file_name [, suffix] ) -> base_name * - * Returns the last component of the filename given in <i>file_name</i>, + * Returns the last component of the filename given in + * <i>file_name</i> (after first stripping trailing separators), * which can be formed using both <code>File::SEPARATOR</code> and * <code>File::ALT_SEPARATOR</code> as the separator when * <code>File::ALT_SEPARATOR</code> is not <code>nil</code>. If @@ -4184,9 +4185,10 @@ rb_file_s_basename(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/file.c#L4185 * File.dirname(file_name) -> dir_name * * Returns all components of the filename given in <i>file_name</i> - * except the last one. The filename can be formed using both - * <code>File::SEPARATOR</code> and <code>File::ALT_SEPARATOR</code> as the - * separator when <code>File::ALT_SEPARATOR</code> is not <code>nil</code>. + * except the last one (after first stripping trailing separators). + * The filename can be formed using both <code>File::SEPARATOR</code> + * and <code>File::ALT_SEPARATOR</code> as the separator when + * <code>File::ALT_SEPARATOR</code> is not <code>nil</code>. * * File.dirname("/home/gumby/work/ruby.rb") #=> "/home/gumby/work" */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/