ruby-changes:28380
From: zzak <ko1@a...>
Date: Wed, 24 Apr 2013 13:47:40 +0900 (JST)
Subject: [ruby-changes:28380] zzak:r40432 (trunk): * class.c: Example of Object#methods by @windwiny [Fixes GH-293]
zzak 2013-04-24 13:47:31 +0900 (Wed, 24 Apr 2013) New Revision: 40432 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40432 Log: * class.c: Example of Object#methods by @windwiny [Fixes GH-293] * ruby.c: Document return values of Kernel #sub, #gsub, and #chop Modified files: trunk/ChangeLog trunk/class.c trunk/ruby.c Index: ChangeLog =================================================================== --- ChangeLog (revision 40431) +++ ChangeLog (revision 40432) @@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Apr 24 13:45:00 2013 Zachary Scott <zachary@z...> + + * 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 <zachary@z...> + + * ext/socket/lib/socket.rb: Doc typos by @vipulnsward [Fixes GH-292] + + Wed Apr 24 12:54:00 2013 Zachary Scott <zachary@z...> * ext/socket/lib/socket.rb: Doc typos by @vipulnsward [Fixes GH-292] Index: class.c =================================================================== --- class.c (revision 40431) +++ class.c (revision 40432) @@ -1117,13 +1117,14 @@ rb_class_public_instance_methods(int arg https://github.com/ruby/ruby/blob/trunk/class.c#L1117 /* * 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 arg https://github.com/ruby/ruby/blob/trunk/class.c#L1135 * # :==~, :!, :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 Index: ruby.c =================================================================== --- ruby.c (revision 40431) +++ ruby.c (revision 40432) @@ -1241,7 +1241,7 @@ uscore_get(void) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1241 /* * call-seq: * sub(pattern, replacement) -> $_ - * sub(pattern) { block } -> $_ + * sub(pattern) {|...| block } -> $_ * * Equivalent to <code>$_.sub(<i>args</i>)</code>, except that * <code>$_</code> will be updated if substitution occurs. @@ -1258,11 +1258,11 @@ rb_f_sub(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1258 /* * call-seq: - * gsub(pattern, replacement) -> string - * gsub(pattern) {|...| block } -> string + * gsub(pattern, replacement) -> $_ + * gsub(pattern) {|...| block } -> $_ * * Equivalent to <code>$_.gsub...</code>, except that <code>$_</code> - * 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) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1277 /* * call-seq: - * chop -> string + * chop -> $_ * * Equivalent to <code>($_.dup).chop!</code>, except <code>nil</code> * is never returned. See <code>String#chop!</code>. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/