diff options
| author | Christopher Aue <[email protected]> | 2017-07-18 20:47:05 +0200 |
|---|---|---|
| committer | Christopher Aue <[email protected]> | 2017-07-18 20:47:05 +0200 |
| commit | dd52b881017ae2c39d8afeed4f0560eff19031da (patch) | |
| tree | 503d6ebe434f9a972934364e1ab4e4768db67264 /mrbgems/mruby-class-ext/src | |
| parent | 52aafcd001095470ac1c397bdf83ce10e919c753 (diff) | |
| download | mruby-dd52b881017ae2c39d8afeed4f0560eff19031da.tar.gz mruby-dd52b881017ae2c39d8afeed4f0560eff19031da.zip | |
implemented Module#singleton_class?
Diffstat (limited to 'mrbgems/mruby-class-ext/src')
| -rw-r--r-- | mrbgems/mruby-class-ext/src/class.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mrbgems/mruby-class-ext/src/class.c b/mrbgems/mruby-class-ext/src/class.c index 8ca7d66c2..5506c4829 100644 --- a/mrbgems/mruby-class-ext/src/class.c +++ b/mrbgems/mruby-class-ext/src/class.c @@ -9,12 +9,19 @@ mrb_mod_name(mrb_state *mrb, mrb_value self) return mrb_nil_p(name)? name : mrb_str_dup(mrb, name); } +static mrb_value +mrb_mod_singleton_class_p(mrb_state *mrb, mrb_value self) +{ + return mrb_bool_value(mrb_type(self) == MRB_TT_SCLASS); +} + void mrb_mruby_class_ext_gem_init(mrb_state *mrb) { struct RClass *mod = mrb->module_class; mrb_define_method(mrb, mod, "name", mrb_mod_name, MRB_ARGS_NONE()); + mrb_define_method(mrb, mod, "singleton_class?", mrb_mod_singleton_class_p, MRB_ARGS_NONE()); } void |
