diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-10-30 08:04:32 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-10-30 08:04:32 +0000 |
commit | ed1881510950af3d8599c1a7dca14d53c35eb348 (patch) | |
tree | 2f685ff48cc03c119fe1d059e933834db03c2dae /object.c | |
parent | a2868ff65166b27acbbda4af1b9df84ed3171541 (diff) | |
download | ruby-ed1881510950af3d8599c1a7dca14d53c35eb348.tar.gz |
* eval.c (rb_mod_public_method_defined, etc.): new methods:
public_method_defined?, private_method_defined?,
protected_method_defined?
* object.c (rb_obj_public_methods): new method
Object#public_methods.
* class.c (ins_methods_i): Object#methods should list both public
and protected methods.
* class.c (rb_class_public_instance_methods): new method
Module#public_instance_methods.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -911,6 +911,16 @@ rb_obj_private_methods(obj) } static VALUE +rb_obj_public_methods(obj) + VALUE obj; +{ + VALUE argv[1]; + + argv[0] = Qtrue; + return rb_class_public_instance_methods(1, argv, CLASS_OF(obj)); +} + +static VALUE convert_type(val, tname, method, raise) VALUE val; const char *tname, *method; @@ -1329,6 +1339,7 @@ Init_Object() rb_define_method(rb_mKernel, "singleton_methods", rb_obj_singleton_methods, -1); rb_define_method(rb_mKernel, "protected_methods", rb_obj_protected_methods, 0); rb_define_method(rb_mKernel, "private_methods", rb_obj_private_methods, 0); + rb_define_method(rb_mKernel, "public_methods", rb_obj_public_methods, 0); rb_define_method(rb_mKernel, "instance_variables", rb_obj_instance_variables, 0); rb_define_private_method(rb_mKernel, "remove_instance_variable", rb_obj_remove_instance_variable, 1); @@ -1400,7 +1411,7 @@ Init_Object() rb_define_singleton_method(rb_cModule, "allocate", rb_module_s_alloc, 0); rb_define_method(rb_cModule, "initialize", rb_mod_initialize, 0); rb_define_method(rb_cModule, "instance_methods", rb_class_instance_methods, -1); - rb_define_method(rb_cModule, "public_instance_methods", rb_class_instance_methods, -1); + rb_define_method(rb_cModule, "public_instance_methods", rb_class_public_instance_methods, -1); rb_define_method(rb_cModule, "protected_instance_methods", rb_class_protected_instance_methods, -1); rb_define_method(rb_cModule, "private_instance_methods", rb_class_private_instance_methods, -1); |