I'd like to ask for your help on an issue when embedding ruby in C++. I am upgrading from an older version of ruby to version 3.2. Previously, I could call ruby_init and ruby_init_loadpath as usual and then things would work, but now I need to call ruby_executable_node before calling ruby_init_loadpath.
Something like this (the parameters to ruby are arbitrary):
char* opt[] = { "ruby", "-v", "-eputs 'Starting'" };
int status;
ruby_executable_node(ruby_options(3, opt), &status);
This doesn't seem like the right thing to do, but unless I do this, all of my ruby objects are missing the class method (the error is undefined method `class'). I went through the changelogs for ruby, but couldn't find anything related to this change. Does anyone know why this happens, or if there is a workaround?
Thank you
Based on this example, you can pass the argument
"-e "
to have Ruby execute no code while passing options. It sounds like that works around your issue.