summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-10-18 00:16:02 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-10-18 00:16:02 +0900
commitf07ee20260156e07c2ca5efe63bf0ea9f3ac8132 (patch)
tree2b7bca10a536f69e7d6c342a9793ae5eecead23a
parent83922d0bbb7de894380fa6b33e7d75061114aa59 (diff)
parent91444aec4bb7d336a6a5043ca1b6b0a8d3291742 (diff)
downloadmruby-f07ee20260156e07c2ca5efe63bf0ea9f3ac8132.tar.gz
mruby-f07ee20260156e07c2ca5efe63bf0ea9f3ac8132.zip
Merge pull request #2995 from Mav7/master
fixed YARD documentation for mrb_obj_new
-rw-r--r--include/mruby.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/mruby.h b/include/mruby.h
index 56d27a09a..d50ec3496 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -496,6 +496,24 @@ MRB_API void mrb_undef_class_method(mrb_state*, struct RClass*, const char*);
/**
* Initialize a new object instace of c class.
*
+ * # Ruby style
+ * class ExampleClass
+ * end
+ *
+ * p ExampleClass # => #<ExampleClass:0x9958588>
+ * // C style
+ * #include <stdio.h>
+ * #include <mruby.h>
+ *
+ * void
+ * mrb_example_gem_init(mrb_state* mrb) {
+ * struct RClass *example_class;
+ * mrb_value obj;
+ *
+ * example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class); # => class ExampleClass; end
+ * obj = mrb_obj_new(mrb, example_class, 0, NULL); # => ExampleClass.new
+ * mrb_p(mrb, obj); // => Kernel#p
+ * }
* @param mrb The current mruby state.
* @param c Reference to the class of the new object.
* @param argc Number of arguments in argv