@@ -17,6 +17,7 @@ VALUE rb_dummy_tests_rb_const_get_at(VALUE self, VALUE name);
1717void rb_dummy_tests_rb_const_set(VALUE self, VALUE name, VALUE val);
1818VALUE rb_dummy_tests_rb_const_defined(VALUE self, VALUE name);
1919VALUE rb_dummy_tests_rb_const_defined_at(VALUE self, VALUE name);
20+ VALUE rb_dummy_tests_rb_eval_string(VALUE self, VALUE str);
2021*/
2122import "C"
2223
@@ -154,6 +155,14 @@ func rb_dummy_tests_rb_const_defined_at(klass C.VALUE, name C.VALUE) C.VALUE {
154155 return C .VALUE (ruby .Qfalse ())
155156}
156157
158+ //export rb_dummy_tests_rb_eval_string
159+ func rb_dummy_tests_rb_eval_string (_ C.VALUE , str C.VALUE ) C.VALUE {
160+ goStr := ruby .Value2String (ruby .VALUE (str ))
161+ ret := ruby .RbEvalString (goStr )
162+
163+ return C .VALUE (ret )
164+ }
165+
157166// defineMethodsToDummyTests define methods in Dummy::Tests
158167func defineMethodsToDummyTests (rb_mDummy ruby.VALUE ) {
159168 rb_cTests := ruby .RbDefineClassUnder (rb_mDummy , "Tests" , ruby .VALUE (C .rb_cObject ))
@@ -173,4 +182,5 @@ func defineMethodsToDummyTests(rb_mDummy ruby.VALUE) {
173182 ruby .RbDefineSingletonMethod (rb_cTests , "rb_const_set" , C .rb_dummy_tests_rb_const_set , 2 )
174183 ruby .RbDefineSingletonMethod (rb_cTests , "rb_const_defined" , C .rb_dummy_tests_rb_const_defined , 1 )
175184 ruby .RbDefineSingletonMethod (rb_cTests , "rb_const_defined_at" , C .rb_dummy_tests_rb_const_defined_at , 1 )
185+ ruby .RbDefineSingletonMethod (rb_cTests , "rb_eval_string" , C .rb_dummy_tests_rb_eval_string , 1 )
176186}
0 commit comments