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

ruby-changes:35004

From: knu <ko1@a...>
Date: Wed, 6 Aug 2014 20:45:56 +0900 (JST)
Subject: [ruby-changes:35004] knu:r47086 (trunk): Move enum.one? documentation before the relevant method.

knu	2014-08-06 20:45:47 +0900 (Wed, 06 Aug 2014)

  New Revision: 47086

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

  Log:
    Move enum.one? documentation before the relevant method.
    
    * enum.c (enum_one): Move enum.one? documentation before the
      relevant method.  Submitted by @vipulnsward. [Fixes GH-687]
      https://github.com/ruby/ruby/pull/687

  Modified files:
    trunk/ChangeLog
    trunk/enum.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47085)
+++ ChangeLog	(revision 47086)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Aug  6 20:44:07 2014  Akinori MUSHA  <knu@i...>
+
+	* enum.c (enum_one): Move enum.one? documentation before the
+	  relevant method.  Submitted by @vipulnsward. [Fixes GH-687]
+	  https://github.com/ruby/ruby/pull/687
+
 Wed Aug  6 20:25:47 2014  Akinori MUSHA  <knu@i...>
 
 	* lib/set.rb (Set#replace): Check if an object given is enumerable
Index: enum.c
===================================================================
--- enum.c	(revision 47085)
+++ enum.c	(revision 47086)
@@ -1105,24 +1105,6 @@ DEFINE_ENUMFUNCS(one) https://github.com/ruby/ruby/blob/trunk/enum.c#L1105
     return Qnil;
 }
 
-/*
- *  call-seq:
- *     enum.one? [{ |obj| block }]   -> true or false
- *
- *  Passes each element of the collection to the given block. The method
- *  returns <code>true</code> if the block returns <code>true</code>
- *  exactly once. If the block is not given, <code>one?</code> will return
- *  <code>true</code> only if exactly one of the collection members is
- *  true.
- *
- *     %w{ant bear cat}.one? { |word| word.length == 4 }  #=> true
- *     %w{ant bear cat}.one? { |word| word.length > 4 }   #=> false
- *     %w{ant bear cat}.one? { |word| word.length < 4 }   #=> false
- *     [ nil, true, 99 ].one?                             #=> false
- *     [ nil, true, false ].one?                          #=> true
- *
- */
-
 struct nmin_data {
   long n;
   long bufmax;
@@ -1307,6 +1289,23 @@ nmin_run(VALUE obj, VALUE num, int by, i https://github.com/ruby/ruby/blob/trunk/enum.c#L1289
 
 }
 
+/*
+ *  call-seq:
+ *     enum.one? [{ |obj| block }]   -> true or false
+ *
+ *  Passes each element of the collection to the given block. The method
+ *  returns <code>true</code> if the block returns <code>true</code>
+ *  exactly once. If the block is not given, <code>one?</code> will return
+ *  <code>true</code> only if exactly one of the collection members is
+ *  true.
+ *
+ *     %w{ant bear cat}.one? { |word| word.length == 4 }  #=> true
+ *     %w{ant bear cat}.one? { |word| word.length > 4 }   #=> false
+ *     %w{ant bear cat}.one? { |word| word.length < 4 }   #=> false
+ *     [ nil, true, 99 ].one?                             #=> false
+ *     [ nil, true, false ].one?                          #=> true
+ *
+ */
 static VALUE
 enum_one(VALUE obj)
 {

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

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