I'm probably missing something trivial, but given the following Ruby code:
class Myclass
@@myvar = 1
def self.myvar
return @@myvar
end
end
I can access @@myvar from Ruby with Myclass::myvar.
Great, but now I need to access that same variable through a C
extension. I think I can get it by doing:
VALUE myvar = rb_eval_string("Myclass::myvar");
but surely there's a better way? I'm thinking something like
rb_cvar_get() but that requires that I pass in a VALUE and all I have is
a string at this point, "Myclass".