summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authorzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-24 04:47:31 +0000
committerzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-24 04:47:31 +0000
commit0b4214ad9b53c2978cbca3ac08d467f03bdabd8d (patch)
tree1a94be2e01774e96a0fd4f69b086ba5f3012de56 /class.c
parent360843ef752f961d66e1b835f19a5ab4af6299dc (diff)
* class.c: Example of Object#methods by @windwiny [Fixes GH-293]
* ruby.c: Document return values of Kernel #sub, #gsub, and #chop git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/class.c b/class.c
index 0f54a80cd5..0913fb48d9 100644
--- a/class.c
+++ b/class.c
@@ -1117,13 +1117,14 @@ rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
/*
* call-seq:
- * obj.methods(all=true) -> array
+ * obj.methods(regular=true) -> array
*
* 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>all</i> parameter is set to <code>false</code>, only those methods
- * in the receiver will be listed.
+ * If the <i>regular</i> parameter is set to <code>false</code>,
+ * Returns an array of obj's public and protected singleton methods,
+ * the array will not include methods in modules included in <i>obj</i>.
*
* class Klass
* def klass_method()
@@ -1134,6 +1135,14 @@ rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
* # :==~, :!, :eql?
* # :hash, :<=>, :class, :singleton_class]
* k.methods.length #=> 57
+ *
+ * k.methods(false) #=> []
+ * def k.singleton_method; end
+ * k.methods(false) #=> [:singleton_method]
+ *
+ * module M123; def m123; end end
+ * k.extend M123
+ * k.methods(false) #=> [:singleton_method]
*/
VALUE