@@ -9,6 +9,18 @@ static VALUE module_specs_test_method(VALUE self) {
9
9
return ID2SYM (rb_intern ("test_method" ));
10
10
}
11
11
12
+ static VALUE module_specs_test_method_2required (VALUE self , VALUE arg1 , VALUE arg2 ) {
13
+ return ID2SYM (rb_intern ("test_method_2required" ));
14
+ }
15
+
16
+ static VALUE module_specs_test_method_c_array (int argc , VALUE * argv , VALUE self ) {
17
+ return ID2SYM (rb_intern ("test_method_c_array" ));
18
+ }
19
+
20
+ static VALUE module_specs_test_method_ruby_array (VALUE self , VALUE args ) {
21
+ return ID2SYM (rb_intern ("test_method_ruby_array" ));
22
+ }
23
+
12
24
static VALUE module_specs_const_defined (VALUE self , VALUE klass , VALUE id ) {
13
25
return rb_const_defined (klass , SYM2ID (id )) ? Qtrue : Qfalse ;
14
26
}
@@ -76,6 +88,21 @@ static VALUE module_specs_rb_define_method(VALUE self, VALUE cls, VALUE str_name
76
88
return Qnil ;
77
89
}
78
90
91
+ static VALUE module_specs_rb_define_method_2required (VALUE self , VALUE cls , VALUE str_name ) {
92
+ rb_define_method (cls , RSTRING_PTR (str_name ), module_specs_test_method_2required , 2 );
93
+ return Qnil ;
94
+ }
95
+
96
+ static VALUE module_specs_rb_define_method_c_array (VALUE self , VALUE cls , VALUE str_name ) {
97
+ rb_define_method (cls , RSTRING_PTR (str_name ), module_specs_test_method_c_array , -1 );
98
+ return Qnil ;
99
+ }
100
+
101
+ static VALUE module_specs_rb_define_method_ruby_array (VALUE self , VALUE cls , VALUE str_name ) {
102
+ rb_define_method (cls , RSTRING_PTR (str_name ), module_specs_test_method_ruby_array , -2 );
103
+ return Qnil ;
104
+ }
105
+
79
106
static VALUE module_specs_rb_define_module_function (VALUE self , VALUE cls , VALUE str_name ) {
80
107
rb_define_module_function (cls , RSTRING_PTR (str_name ), module_specs_test_method , 0 );
81
108
return Qnil ;
@@ -132,6 +159,10 @@ void Init_module_spec(void) {
132
159
module_specs_rb_define_global_function , 1 );
133
160
134
161
rb_define_method (cls , "rb_define_method" , module_specs_rb_define_method , 2 );
162
+ rb_define_method (cls , "rb_define_method_2required" , module_specs_rb_define_method_2required , 2 );
163
+ rb_define_method (cls , "rb_define_method_c_array" , module_specs_rb_define_method_c_array , 2 );
164
+ rb_define_method (cls , "rb_define_method_ruby_array" , module_specs_rb_define_method_ruby_array , 2 );
165
+
135
166
rb_define_method (cls , "rb_define_module_function" ,
136
167
module_specs_rb_define_module_function , 2 );
137
168
0 commit comments