* class.c: [DOC] Fixed grammar and examples of instance_methods.
By @alex-frost via documenting-ruby/ruby#31 [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0be4ec01cd
commit
10e7f389e2
@ -1,3 +1,8 @@
|
|||||||
|
Sun May 25 09:41:56 2014 Zachary Scott <e@zzak.io>
|
||||||
|
|
||||||
|
* 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@fsij.org>
|
Sun May 25 09:40:44 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* test/lib/minitest/unit.rb: Show leakes threads and tempfiles.
|
* test/lib/minitest/unit.rb: Show leakes threads and tempfiles.
|
||||||
|
30
class.c
30
class.c
@ -1181,25 +1181,25 @@ class_instance_method_list(int argc, VALUE *argv, VALUE mod, int obj, int (*func
|
|||||||
*
|
*
|
||||||
* Returns an array containing the names of the public and protected instance
|
* 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;
|
* 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
|
* for a class, they are the instance (not singleton) methods. If the optional
|
||||||
* argument, or with an argument that is <code>false</code>, the
|
* parameter is <code>false</code>, the methods of any ancestors are not included.
|
||||||
* instance methods in <i>mod</i> are returned, otherwise the methods
|
|
||||||
* in <i>mod</i> and <i>mod</i>'s superclasses are returned.
|
|
||||||
*
|
*
|
||||||
* module A
|
* module A
|
||||||
* def method1() end
|
* def method1() end
|
||||||
* end
|
* end
|
||||||
* class B
|
* class B
|
||||||
|
* include A
|
||||||
* def method2() end
|
* def method2() end
|
||||||
* end
|
* end
|
||||||
* class C < B
|
* class C < B
|
||||||
* def method3() end
|
* def method3() end
|
||||||
* end
|
* end
|
||||||
*
|
*
|
||||||
* A.instance_methods #=> [:method1]
|
* A.instance_methods(false) #=> [:method1]
|
||||||
* B.instance_methods(false) #=> [:method2]
|
* B.instance_methods(false) #=> [:method2]
|
||||||
|
* B.instance_methods(true).include?(:method1) #=> true
|
||||||
* C.instance_methods(false) #=> [:method3]
|
* C.instance_methods(false) #=> [:method3]
|
||||||
* C.instance_methods(true).length #=> 43
|
* C.instance_methods.include?(:method2) #=> true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
@ -1213,8 +1213,8 @@ rb_class_instance_methods(int argc, VALUE *argv, VALUE mod)
|
|||||||
* mod.protected_instance_methods(include_super=true) -> array
|
* mod.protected_instance_methods(include_super=true) -> array
|
||||||
*
|
*
|
||||||
* Returns a list of the protected instance methods defined in
|
* Returns a list of the protected instance methods defined in
|
||||||
* <i>mod</i>. If the optional parameter is not <code>false</code>, the
|
* <i>mod</i>. If the optional parameter is <code>false</code>, the
|
||||||
* methods of any ancestors are included.
|
* methods of any ancestors are not included.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
@ -1228,8 +1228,8 @@ rb_class_protected_instance_methods(int argc, VALUE *argv, VALUE mod)
|
|||||||
* mod.private_instance_methods(include_super=true) -> array
|
* mod.private_instance_methods(include_super=true) -> array
|
||||||
*
|
*
|
||||||
* Returns a list of the private instance methods defined in
|
* Returns a list of the private instance methods defined in
|
||||||
* <i>mod</i>. If the optional parameter is not <code>false</code>, the
|
* <i>mod</i>. If the optional parameter is <code>false</code>, the
|
||||||
* methods of any ancestors are included.
|
* methods of any ancestors are not included.
|
||||||
*
|
*
|
||||||
* module Mod
|
* module Mod
|
||||||
* def method1() end
|
* def method1() end
|
||||||
@ -1251,8 +1251,8 @@ rb_class_private_instance_methods(int argc, VALUE *argv, VALUE mod)
|
|||||||
* mod.public_instance_methods(include_super=true) -> array
|
* mod.public_instance_methods(include_super=true) -> array
|
||||||
*
|
*
|
||||||
* Returns a list of the public instance methods defined in <i>mod</i>.
|
* 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
|
* If the optional parameter is <code>false</code>, the methods of
|
||||||
* any ancestors are included.
|
* any ancestors are not included.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
@ -1268,8 +1268,8 @@ rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
|
|||||||
* Returns a list of the names of public and protected methods of
|
* 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>. This will include all the methods accessible in
|
||||||
* <i>obj</i>'s ancestors.
|
* <i>obj</i>'s ancestors.
|
||||||
* If the <i>regular</i> parameter is set to <code>false</code>,
|
* If the optional parameter is <code>false</code>, it
|
||||||
* Returns an array of obj's public and protected singleton methods,
|
* 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>.
|
* the array will not include methods in modules included in <i>obj</i>.
|
||||||
*
|
*
|
||||||
* class Klass
|
* class Klass
|
||||||
@ -1280,7 +1280,7 @@ rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
|
|||||||
* k.methods[0..9] #=> [:klass_method, :nil?, :===,
|
* k.methods[0..9] #=> [:klass_method, :nil?, :===,
|
||||||
* # :==~, :!, :eql?
|
* # :==~, :!, :eql?
|
||||||
* # :hash, :<=>, :class, :singleton_class]
|
* # :hash, :<=>, :class, :singleton_class]
|
||||||
* k.methods.length #=> 57
|
* k.methods.length #=> 56
|
||||||
*
|
*
|
||||||
* k.methods(false) #=> []
|
* k.methods(false) #=> []
|
||||||
* def k.singleton_method; end
|
* def k.singleton_method; end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user