File tree 2 files changed +6
-0
lines changed
2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ impl ExportedFunctions {
27
27
Self { instance }
28
28
}
29
29
30
+ /// Check that an exported function exists.
30
31
pub fn respond_to_missing ( & self , method_name : & str ) -> bool {
31
32
self . instance . dyn_func ( method_name) . is_ok ( )
32
33
}
@@ -173,10 +174,12 @@ methods!(
173
174
RubyExportedFunctions ,
174
175
itself,
175
176
177
+ // Glue code to call the `ExportedFunctions.respond_to` method.
176
178
fn ruby_exported_functions_method_exists( symbol: Symbol , _include_private: Boolean ) -> Boolean {
177
179
unwrap_or_raise( || {
178
180
let symbol = symbol?;
179
181
let instance = itself. get_data( & * EXPORTED_FUNCTIONS_WRAPPER ) ;
182
+
180
183
Ok ( Boolean :: new( instance. respond_to_missing( symbol. to_str( ) ) ) )
181
184
} )
182
185
}
Original file line number Diff line number Diff line change @@ -34,10 +34,13 @@ pub extern "C" fn Init_wasmer() {
34
34
wasmer_module
35
35
. define_nested_class ( "ExportedFunctions" , Some ( & exported_functions_data_class) )
36
36
. define ( |itself| {
37
+ // Declare the `respond_to_missing?` method.
37
38
itself. def (
38
39
"respond_to_missing?" ,
39
40
instance:: ruby_exported_functions_method_exists,
40
41
) ;
42
+
43
+ // Declare the `method_missing` method.
41
44
itself. def (
42
45
"method_missing" ,
43
46
instance:: ruby_exported_functions_method_missing,
You can’t perform that action at this time.
0 commit comments