From 0b4214ad9b53c2978cbca3ac08d467f03bdabd8d Mon Sep 17 00:00:00 2001 From: zzak Date: Wed, 24 Apr 2013 04:47:31 +0000 Subject: [PATCH] * 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 --- ChangeLog | 10 ++++++++++ class.c | 15 ++++++++++++--- ruby.c | 10 +++++----- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index f7e26e21bd..4fa6f52d36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Wed Apr 24 13:45:00 2013 Zachary Scott + + * class.c: Example of Object#methods by @windwiny [Fixes GH-293] + * ruby.c: Document return values of Kernel #sub, #gsub, and #chop + +Wed Apr 24 12:54:00 2013 Zachary Scott + + * ext/socket/lib/socket.rb: Doc typos by @vipulnsward [Fixes GH-292] + + Wed Apr 24 12:54:00 2013 Zachary Scott * ext/socket/lib/socket.rb: Doc typos by @vipulnsward [Fixes GH-292] 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 * obj. This will include all the methods accessible in * obj's ancestors. - * If the all parameter is set to false, only those methods - * in the receiver will be listed. + * If the regular parameter is set to false, + * Returns an array of obj's public and protected singleton methods, + * the array will not include methods in modules included in obj. * * 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 diff --git a/ruby.c b/ruby.c index 6b61162a8a..c1c65137af 100644 --- a/ruby.c +++ b/ruby.c @@ -1241,7 +1241,7 @@ uscore_get(void) /* * call-seq: * sub(pattern, replacement) -> $_ - * sub(pattern) { block } -> $_ + * sub(pattern) {|...| block } -> $_ * * Equivalent to $_.sub(args), except that * $_ will be updated if substitution occurs. @@ -1258,11 +1258,11 @@ rb_f_sub(int argc, VALUE *argv) /* * call-seq: - * gsub(pattern, replacement) -> string - * gsub(pattern) {|...| block } -> string + * gsub(pattern, replacement) -> $_ + * gsub(pattern) {|...| block } -> $_ * * Equivalent to $_.gsub..., except that $_ - * receives the modified result. + * will be updated if substitution occurs. * Available only when -p/-n command line option specified. * */ @@ -1277,7 +1277,7 @@ rb_f_gsub(int argc, VALUE *argv) /* * call-seq: - * chop -> string + * chop -> $_ * * Equivalent to ($_.dup).chop!, except nil * is never returned. See String#chop!.