I'm looking for a function that can get me all the keys from a hash, or I can skip the hash to get one key at a time.
I am currently the key to hard coding
VALUE option = rb_hash_aref(options, rb_str_new2("some_key"));
You can iterate over key / value pairs using the callback function using rb_hash_foreach ( blog post with an example ):
rb_hash_foreach
void rb_hash_foreach(VALUE, int (*)(ANYARGS), VALUE);
There are rb_hash_keys in the MRI , but this is not in any header files, so using this can be risky.
rb_hash_keys
You can always call the Ruby method itself:
VALUE keys = rb_funcall(hash, rb_intern("keys"), 0)
Source: https://habr.com/ru/post/979408/More articles:Android accessories wireless configuration option? - androidSQL, last time using row_number () over the section - sqlJasper report - only print group title when at least one part is on the page - jasper-reportsTypeScript - should it be? (where is == global reach) - javascriptIdiomatic Python for nontrivial lists - pythongroovy: how to pass varargs and close the method at the same time? - closuresConfused about using 'std :: istreambuf_iterator' - c ++Check if JNA is included in Cassandra - cassandrapython module development workflow - configuration and assembly - pythonConstructor and new operator in Java - javaAll Articles