• R/O
  • HTTP
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

mrubyを超漢字で動作させる


Commit MetaInfo

修訂4e63ea96493d7a074277d59a395401182f02d4a3 (tree)
時間2015-11-15 05:10:52
作者Yukihiro "Matz" Matsumoto <matz@ruby...>
CommiterYukihiro "Matz" Matsumoto

Log Message

Merge pull request #3011 from Mav7/master

Added more YARD docs to mruby.h

Change Summary

差異

--- a/build_config.rb
+++ b/build_config.rb
@@ -21,7 +21,6 @@ MRuby::Build.new do |conf|
2121
2222 # include the default GEMs
2323 conf.gembox 'default'
24-
2524 # C compiler settings
2625 # conf.cc do |cc|
2726 # cc.command = ENV['CC'] || 'gcc'
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -548,7 +548,7 @@ MRB_API struct RClass * mrb_class_new(mrb_state *mrb, struct RClass *super);
548548 MRB_API struct RClass * mrb_module_new(mrb_state *mrb);
549549
550550 /**
551- * Creates a new module, Module.
551+ * Returns an mrb_bool. True if class was defined, and false if the class was not defined.
552552 *
553553 * Example:
554554 * void
@@ -610,8 +610,58 @@ MRB_API struct RClass * mrb_module_get(mrb_state *mrb, const char *name);
610610 MRB_API struct RClass * mrb_module_get_under(mrb_state *mrb, struct RClass *outer, const char *name);
611611 MRB_API mrb_value mrb_notimplement_m(mrb_state*, mrb_value);
612612
613+/**
614+ * Duplicate an object.
615+ *
616+ * Equivalent to:
617+ * Object#dup
618+ * @param mrb The current mruby state.
619+ * @param obj Object to be duplicate.
620+ * @return The newly duplicated object.
621+ */
613622 MRB_API mrb_value mrb_obj_dup(mrb_state *mrb, mrb_value obj);
614623 MRB_API mrb_value mrb_check_to_integer(mrb_state *mrb, mrb_value val, const char *method);
624+
625+/**
626+ * Returns true if obj responds to the given method. If the method was defined for that
627+ * class it returns true, it returns false otherwise.
628+ *
629+ * Example:
630+ * # Ruby style
631+ * class ExampleClass
632+ * def example_method
633+ * end
634+ * end
635+ *
636+ * ExampleClass.new.respond_to?(:example_method) # => true
637+ *
638+ * // C style
639+ * void
640+ * mrb_example_gem_init(mrb_state* mrb) {
641+ * struct RClass *example_class;
642+ * mrb_sym mid;
643+ * mrb_bool obj_resp;
644+ *
645+ * example_class = mrb_define_class(mrb, "ExampleClass", mrb->object_class);
646+ * mrb_define_method(mrb, example_class, "example_method", exampleMethod, MRB_ARGS_NONE());
647+ * mid = mrb_intern_str(mrb, mrb_str_new_cstr(mrb, "example_method" ));
648+ * obj_resp = mrb_obj_respond_to(mrb, example_class, mid); // => 1(true in Ruby world)
649+ *
650+ * // If mrb_obj_respond_to returns 1 then puts "True"
651+ * // If mrb_obj_respond_to returns 0 then puts "False"
652+ * if (obj_resp == 1) {
653+ * puts("True");
654+ * }
655+ * else if (obj_resp == 0) {
656+ * puts("False");
657+ * }
658+ * }
659+ *
660+ * @param mrb The current mruby state.
661+ * @param c A reference to a class.
662+ * @param mid A symbol referencing a method id.
663+ * @return mrb_bool A boolean value.
664+ */
615665 MRB_API mrb_bool mrb_obj_respond_to(mrb_state *mrb, struct RClass* c, mrb_sym mid);
616666
617667 /**