diff options
author | Benoit Daloze <[email protected]> | 2020-03-28 00:22:51 +0100 |
---|---|---|
committer | Benoit Daloze <[email protected]> | 2020-03-28 00:22:51 +0100 |
commit | f234d51eaba861edea925eabb564a0bee41b96a0 (patch) | |
tree | 3334f36a91fe81ec704f2980ab169231f52c41d0 /spec/ruby/optional/capi/ext/language_spec.c | |
parent | 296f68816cf575b3ff920f92aec8a4109a7d81d4 (diff) |
Update to ruby/spec@ec84479
Diffstat (limited to 'spec/ruby/optional/capi/ext/language_spec.c')
-rw-r--r-- | spec/ruby/optional/capi/ext/language_spec.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/optional/capi/ext/language_spec.c b/spec/ruby/optional/capi/ext/language_spec.c index 5aeac63f53..749c188956 100644 --- a/spec/ruby/optional/capi/ext/language_spec.c +++ b/spec/ruby/optional/capi/ext/language_spec.c @@ -24,9 +24,17 @@ static VALUE language_spec_switch(VALUE self, VALUE value) { } } +/* Defining a local variable rb_mProcess which already exists as a global variable + * For instance eventmachine does this in Init_rubyeventmachine() */ +static VALUE language_spec_global_local_var(VALUE self) { + VALUE rb_mProcess = rb_const_get(rb_cObject, rb_intern("Process")); + return rb_mProcess; +} + void Init_language_spec(void) { VALUE cls = rb_define_class("CApiLanguageSpecs", rb_cObject); rb_define_method(cls, "switch", language_spec_switch, 1); + rb_define_method(cls, "global_local_var", language_spec_global_local_var, 0); } #ifdef __cplusplus |