Created
May 1, 2015 22:49
-
-
Save simi/d6f2be86694ce6962e84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/object.c b/object.c | |
index 79358ad..425c10c 100644 | |
--- a/object.c | |
+++ b/object.c | |
@@ -1980,11 +1980,13 @@ static VALUE | |
rb_mod_attr_reader(int argc, VALUE *argv, VALUE klass) | |
{ | |
int i; | |
+ VALUE result = rb_ary_new2((long)argc); | |
for (i=0; i<argc; i++) { | |
rb_attr(klass, id_for_attr(argv[i]), TRUE, FALSE, TRUE); | |
+ rb_ary_push(result, argv[i]); | |
} | |
- return Qnil; | |
+ return result; | |
} | |
VALUE | |
diff --git a/vm_method.c b/vm_method.c | |
index c7caccb..2da1f57 100644 | |
--- a/vm_method.c | |
+++ b/vm_method.c | |
@@ -1364,22 +1364,38 @@ rb_mod_alias_method(VALUE mod, VALUE newname, VALUE oldname) | |
static void | |
set_method_visibility(VALUE self, int argc, const VALUE *argv, rb_method_flag_t ex) | |
{ | |
- int i; | |
- | |
- if (argc == 0) { | |
- rb_warning("%"PRIsVALUE" with no argument is just ignored", | |
- QUOTE_ID(rb_frame_callee())); | |
- return; | |
+ int i; | |
+ | |
+ if (argc == 0) { | |
+ rb_warning("%"PRIsVALUE" with no argument is just ignored", | |
+ QUOTE_ID(rb_frame_callee())); | |
+ return; | |
+ } else if(argc ==1 && RB_TYPE_P(argv[0], T_ARRAY)) { | |
+ int count = RARRAY_LENINT(argv[0]); | |
+ for(i = 0; i < count; i++) { | |
+ ID id; | |
+ VALUE v = RARRAY_AREF(argv[0], i);; | |
+ // printf("exporting a %s\n", RSTRING_PTR(rb_inspect(v))); | |
+ | |
+ id = rb_check_id(&v); | |
+ if (!id) { | |
+ rb_print_undef_str(self, v); | |
+ } | |
+ rb_export_method(self, id, ex); | |
} | |
- | |
+ } else { | |
for (i = 0; i < argc; i++) { | |
- VALUE v = argv[i]; | |
- ID id = rb_check_id(&v); | |
- if (!id) { | |
- rb_print_undef_str(self, v); | |
- } | |
- rb_export_method(self, id, ex); | |
+ ID id; | |
+ VALUE v = argv[i]; | |
+ | |
+ // printf("exporting b %s\n", RSTRING_PTR(rb_inspect(v))); | |
+ id = rb_check_id(&v); | |
+ if (!id) { | |
+ rb_print_undef_str(self, v); | |
+ } | |
+ rb_export_method(self, id, ex); | |
} | |
+ } | |
} | |
static VALUE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment