summaryrefslogtreecommitdiffhomepage
path: root/include/mruby.h
diff options
context:
space:
mode:
authorFelix Jones <[email protected]>2016-11-06 13:01:21 +0000
committerFelix Jones <[email protected]>2016-11-06 13:01:21 +0000
commit8d6aa06548929000d98004f5bcbb57bfd1afd4e9 (patch)
tree2c66cbb1e5cea8c3a8f72f9d067ef5da8d159137 /include/mruby.h
parent0b8d8dd379fc5df137477019f0ae355d7a01735f (diff)
downloadmruby-8d6aa06548929000d98004f5bcbb57bfd1afd4e9.tar.gz
mruby-8d6aa06548929000d98004f5bcbb57bfd1afd4e9.zip
Added mrb_class_under_defined
Diffstat (limited to 'include/mruby.h')
-rw-r--r--include/mruby.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/mruby.h b/include/mruby.h
index 25514ee2c..a603a316d 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -567,6 +567,37 @@ MRB_API mrb_bool mrb_class_defined(mrb_state *mrb, const char *name);
MRB_API struct RClass * mrb_class_get(mrb_state *mrb, const char *name);
/**
+ * Returns an mrb_bool. True if child class was defined, and false if the child class was not defined.
+ *
+ * Example:
+ * void
+ * mrb_example_gem_init(mrb_state* mrb) {
+ * struct RClass *example_parent, *example_child;
+ * mrb_bool cd;
+ *
+ * example_parent = mrb_define_module(mrb, "ExampleParent");
+ *
+ * example_child = mrb_define_class(mrb, "ExampleChild", mrb->object_class);
+ * cd = mrb_class_under_defined(mrb, example_parent, "ExampleChild");
+ *
+ * // If mrb_class_under_defined returns 1 then puts "True"
+ * // If mrb_class_under_defined returns 0 then puts "False"
+ * if (cd == 1){
+ * puts("True");
+ * }
+ * else {
+ * puts("False");
+ * }
+ * }
+ *
+ * @param [mrb_state*] mrb The current mruby state.
+ * @param [struct RClass *] outer The name of the parent class.
+ * @param [const char *] name A string representing the name of the child class.
+ * @return [mrb_bool] A boolean value.
+ */
+MRB_API mrb_bool mrb_class_under_defined(mrb_state *mrb, struct RClass *outer, const char *name);
+
+/**
* Gets a child class.
* @param [mrb_state*] mrb The current mruby state.
* @param [struct RClass *] outer The name of the parent class.