[#3006] CVS repository — "Eugene Scripnik" <hoaz@...>

Hello.

21 messages 2004/06/16
[#3008] Re: CVS repository — ts <decoux@...> 2004/06/16

>>>>> "E" == Eugene Scripnik <hoaz@gala.net> writes:

[#3009] Re: CVS repository — Michal Rokos <michal@...> 2004/06/16

Hi!

[#3057] Ruby 1.8.2 to be released. — matz@... (Yukihiro Matsumoto)

Hi,

20 messages 2004/06/23

[Doc] obj.singleton_methods

From: Michal Rokos <michal@...>
Date: 2004-06-14 20:08:39 UTC
List: ruby-core #2996
Hi,

doc or Object#singleton_methods is wrong.

The default is true = all methods (not false)....

Is ether ruby bug/or doc bug...

Wasn't been thinking about, just sending in order not to forget it...

	Michal

PS: And small cleanup for rb_define_method() as bonus :)

Index: class.c
===================================================================
RCS file: /var/cvs/src/ruby/class.c,v
retrieving revision 1.85
diff -u -u -p -r1.85 class.c
--- class.c     12 May 2004 02:51:29 -0000      1.85
+++ class.c     14 Jun 2004 20:07:56 -0000
@@ -730,10 +730,10 @@ rb_class_public_instance_methods(argc, a

 /*
  *  call-seq:
- *     obj.singleton_methods(all=false)    => array
+ *     obj.singleton_methods(all=true)    => array
  *
  *  Returns an array of the names of singleton methods for <i>obj</i>.
- *  If the optional <i>all</i> parameter is true, the list will include
+ *  If the optional <i>all</i> parameter is false, the list will NOT 
include
  *  methods in modules included in <i>obj</i>.
  *
  *     module Other
@@ -756,8 +756,8 @@ rb_class_public_instance_methods(argc, a
  *     end
  *
  *     Single.singleton_methods    #=> ["four"]
- *     a.singleton_methods         #=> ["two", "one"]
- *     a.singleton_methods(true)   #=> ["two", "one", "three"]
+ *     a.singleton_methods         #=> ["two", "one", "three"]
+ *     a.singleton_methods(false)  #=> ["two", "one"]
  */

 VALUE
@@ -809,11 +809,7 @@ rb_define_method(klass, name, func, argc
     VALUE (*func)();
     int argc;
 {
-    ID id = rb_intern(name);
-    int ex = NOEX_PUBLIC;
-
-
-    rb_add_method(klass, id, NEW_CFUNC(func, argc), ex);
+    rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc), 
NOEX_PUBLIC);
 }

 void

In This Thread

Prev Next