@@ -36,6 +36,17 @@ as published by the Free Software Foundation; either version
36
36
#include " YRuby.h"
37
37
#include " Y2RubyUtils.h"
38
38
39
+
40
+ // HELPER method to inspect ruby values from C++. Useful for debugging
41
+ /*
42
+ // usage: log_inspect("surely not nil, foobar", foobar);
43
+ static void log_inspect(const char * message, VALUE v)
44
+ {
45
+ VALUE inspect = rb_funcall(v, rb_intern("inspect"), 0);
46
+ y2internal("%s: %s", message, StringValueCStr(inspect));
47
+ }
48
+ */
49
+
39
50
/* *
40
51
* Exception raised when type signature in ruby class is invalid
41
52
*/
@@ -274,15 +285,12 @@ VALUE YRubyNamespace::getRubyModule()
274
285
int YRubyNamespace::addMethods (VALUE module )
275
286
{
276
287
VALUE methods = rb_funcall (module , rb_intern (" published_functions" ),0 );
277
- methods = rb_funcall (methods,rb_intern (" values" ),0 );
278
288
int j = 0 ;
279
289
for (int i = 0 ; i < RARRAY_LEN (methods); ++i)
280
290
{
281
- VALUE method = rb_ary_entry (methods,i);
282
- if (getenv (" Y2ALLGLOBAL" ) == NULL && RTEST (rb_funcall (method, rb_intern (" private?" ), 0 )))
283
- continue ;
284
- VALUE method_name = rb_funcall (method, rb_intern (" function" ), 0 );
285
- VALUE type = rb_funcall (method,rb_intern (" type" ),0 );
291
+ VALUE method = rb_ary_entry (methods, i);
292
+ VALUE method_name = rb_ary_entry (method, 0 );
293
+ VALUE type = rb_ary_entry (method, 1 );
286
294
string signature = StringValueCStr (type);
287
295
288
296
addMethod (rb_id2name (SYM2ID (method_name)), signature, j++);
@@ -293,18 +301,12 @@ int YRubyNamespace::addMethods(VALUE module)
293
301
int YRubyNamespace::addVariables (VALUE module , int offset)
294
302
{
295
303
VALUE variables = rb_funcall (module , rb_intern (" published_variables" ),0 );
296
- variables = rb_funcall (variables,rb_intern (" values" ),0 );
297
304
int j=0 ;
298
305
for (int i = 0 ; i < RARRAY_LEN (variables); ++i)
299
306
{
300
- VALUE variable = rb_ary_entry (variables,i);
301
- VALUE variable_name = rb_funcall (variable, rb_intern (" variable" ), 0 );
302
- if (getenv (" Y2ALLGLOBAL" ) == NULL && RTEST (rb_funcall (variable, rb_intern (" private?" ), 0 )))
303
- {
304
- y2debug (" variable: '%s' is private and not needed" , rb_id2name (SYM2ID (variable_name)));
305
- continue ;
306
- }
307
- VALUE type = rb_funcall (variable,rb_intern (" type" ),0 );
307
+ VALUE variable = rb_ary_entry (variables, i);
308
+ VALUE variable_name = rb_ary_entry (variable, 0 );
309
+ VALUE type = rb_ary_entry (variable, 1 );
308
310
string signature = StringValueCStr (type);
309
311
constTypePtr sym_tp = Type::fromSignature (signature);
310
312
0 commit comments