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

ruby-changes:34009

From: zzak <ko1@a...>
Date: Sun, 25 May 2014 09:43:20 +0900 (JST)
Subject: [ruby-changes:34009] zzak:r46090 (trunk): * class.c: [DOC] Fixed grammar and examples of instance_methods.

zzak	2014-05-25 09:43:14 +0900 (Sun, 25 May 2014)

  New Revision: 46090

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

  Log:
    * class.c: [DOC] Fixed grammar and examples of instance_methods.
      By @alex-frost via documenting-ruby/ruby#31 [ci skip]

  Modified files:
    trunk/ChangeLog
    trunk/class.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46089)
+++ ChangeLog	(revision 46090)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun May 25 09:41:56 2014  Zachary Scott  <e@z...>
+
+	* class.c: [DOC] Fixed grammar and examples of instance_methods.
+	  By @alex-frost via documenting-ruby/ruby#31
+
 Sun May 25 09:40:44 2014  Tanaka Akira  <akr@f...>
 
 	* test/lib/minitest/unit.rb: Show leakes threads and tempfiles.
Index: class.c
===================================================================
--- class.c	(revision 46089)
+++ class.c	(revision 46090)
@@ -1181,25 +1181,25 @@ class_instance_method_list(int argc, VAL https://github.com/ruby/ruby/blob/trunk/class.c#L1181
  *
  *  Returns an array containing the names of the public and protected instance
  *  methods in the receiver. For a module, these are the public and protected methods;
- *  for a class, they are the instance (not singleton) methods. With no
- *  argument, or with an argument that is <code>false</code>, the
- *  instance methods in <i>mod</i> are returned, otherwise the methods
- *  in <i>mod</i> and <i>mod</i>'s superclasses are returned.
+ *  for a class, they are the instance (not singleton) methods. If the optional
+ *  parameter is <code>false</code>, the methods of any ancestors are not included.
  *
  *     module A
  *       def method1()  end
  *     end
  *     class B
+ *       include A
  *       def method2()  end
  *     end
  *     class C < B
  *       def method3()  end
  *     end
  *
- *     A.instance_methods                #=> [:method1]
- *     B.instance_methods(false)         #=> [:method2]
- *     C.instance_methods(false)         #=> [:method3]
- *     C.instance_methods(true).length   #=> 43
+ *     A.instance_methods(false)                   #=> [:method1]
+ *     B.instance_methods(false)                   #=> [:method2]
+ *     B.instance_methods(true).include?(:method1) #=> true
+ *     C.instance_methods(false)                   #=> [:method3]
+ *     C.instance_methods.include?(:method2)       #=> true
  */
 
 VALUE
@@ -1213,8 +1213,8 @@ rb_class_instance_methods(int argc, VALU https://github.com/ruby/ruby/blob/trunk/class.c#L1213
  *     mod.protected_instance_methods(include_super=true)   -> array
  *
  *  Returns a list of the protected instance methods defined in
- *  <i>mod</i>. If the optional parameter is not <code>false</code>, the
- *  methods of any ancestors are included.
+ *  <i>mod</i>. If the optional parameter is <code>false</code>, the
+ *  methods of any ancestors are not included.
  */
 
 VALUE
@@ -1228,8 +1228,8 @@ rb_class_protected_instance_methods(int https://github.com/ruby/ruby/blob/trunk/class.c#L1228
  *     mod.private_instance_methods(include_super=true)    -> array
  *
  *  Returns a list of the private instance methods defined in
- *  <i>mod</i>. If the optional parameter is not <code>false</code>, the
- *  methods of any ancestors are included.
+ *  <i>mod</i>. If the optional parameter is <code>false</code>, the
+ *  methods of any ancestors are not included.
  *
  *     module Mod
  *       def method1()  end
@@ -1251,8 +1251,8 @@ rb_class_private_instance_methods(int ar https://github.com/ruby/ruby/blob/trunk/class.c#L1251
  *     mod.public_instance_methods(include_super=true)   -> array
  *
  *  Returns a list of the public instance methods defined in <i>mod</i>.
- *  If the optional parameter is not <code>false</code>, the methods of
- *  any ancestors are included.
+ *  If the optional parameter is <code>false</code>, the methods of
+ *  any ancestors are not included.
  */
 
 VALUE
@@ -1268,8 +1268,8 @@ rb_class_public_instance_methods(int arg https://github.com/ruby/ruby/blob/trunk/class.c#L1268
  *  Returns a list of the names of public and protected methods of
  *  <i>obj</i>. This will include all the methods accessible in
  *  <i>obj</i>'s ancestors.
- *  If the <i>regular</i> parameter is set to <code>false</code>,
- *  Returns an array of obj's public and protected singleton methods,
+ *  If the optional parameter is <code>false</code>, it
+ *  returns an array of <i>obj<i>'s public and protected singleton methods,
  *  the array will not include methods in modules included in <i>obj</i>.
  *
  *     class Klass
@@ -1280,7 +1280,7 @@ rb_class_public_instance_methods(int arg https://github.com/ruby/ruby/blob/trunk/class.c#L1280
  *     k.methods[0..9]    #=> [:klass_method, :nil?, :===,
  *                        #    :==~, :!, :eql?
  *                        #    :hash, :<=>, :class, :singleton_class]
- *     k.methods.length   #=> 57
+ *     k.methods.length   #=> 56
  *
  *     k.methods(false)   #=> []
  *     def k.singleton_method; end

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

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