• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

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

mrubyを超漢字で動作させる


Commit MetaInfo

Revisãoa5b416e2ce31f28ec4c588b3bc1d0b0567faf7ba (tree)
Hora2015-10-14 15:50:12
AutorRalph Desir(Mav7) <battleroundscool@gmai...>
CommiterRalph Desir(Mav7)

Mensagem de Log

Added documentation for mrb_undef_method

Mudança Sumário

Diff

--- a/build_config.rb
+++ b/build_config.rb
@@ -21,7 +21,7 @@ MRuby::Build.new do |conf|
2121
2222 # include the default GEMs
2323 conf.gembox 'default'
24-
24+ conf.gem '/home/thamav/tests/mrbgems_test'
2525 # C compiler settings
2626 # conf.cc do |cc|
2727 # cc.command = ENV['CC'] || 'gcc'
@@ -82,7 +82,7 @@ MRuby::Build.new do |conf|
8282 # bintest
8383 # conf.enable_bintest
8484 end
85-
85+=begin
8686 MRuby::Build.new('host-debug') do |conf|
8787 # load specific toolchain settings
8888
@@ -117,7 +117,7 @@ MRuby::Build.new('test') do |conf|
117117
118118 conf.gembox 'default'
119119 end
120-
120+=end
121121 # Define cross build settings
122122 # MRuby::CrossBuild.new('32bit') do |conf|
123123 # toolchain :gcc
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -243,8 +243,8 @@ MRB_API mrb_value mrb_singleton_class(mrb_state*, mrb_value);
243243 * Include a module in another class or module.
244244 * Equivalent to:
245245 *
246- * module B *
247- * include A *
246+ * module B
247+ * include A
248248 * end
249249 * @param mrb_state* The current mruby state.
250250 * @param RClass* A reference to module or a class.
@@ -348,6 +348,65 @@ MRB_API void mrb_define_module_function(mrb_state*, struct RClass*, const char*,
348348 * @param mrb_value The value for the constant.
349349 */
350350 MRB_API void mrb_define_const(mrb_state*, struct RClass*, const char *name, mrb_value);
351+
352+/**
353+ * Undefines a method.
354+ *
355+ * # Ruby style
356+ *
357+ * class A
358+ *
359+ * def a
360+ * "a"
361+ * end
362+ *
363+ * end
364+ *
365+ * A.new.a # => a
366+ *
367+ * class B < A
368+ *
369+ * undef_method :a
370+ *
371+ * end
372+ *
373+ * B.new.a # => undefined method 'a' for B (NoMethodError)
374+ *
375+ * // C style
376+ *
377+ * mrb_value
378+ * mrb_a(mrb_state *mrb){
379+ *
380+ * return mrb_str_new_cstr(mrb, "a");
381+ *
382+ * }
383+ *
384+ * void
385+ * mrb_example_gem_init(mrb_state* mrb){
386+ * struct RClass *a;
387+ * struct RClass *b;
388+ * struct RClass *c;
389+ *
390+ * a = mrb_define_class(mrb, "A", mrb->object_class);
391+ *
392+ * mrb_define_method(mrb, a, "a", mrb_a, MRB_ARGS_NONE());
393+ *
394+ * b = mrb_define_class(mrb, "B", a);
395+ *
396+ * c = mrb_define_class(mrb, "C", b);
397+ *
398+ * mrb_undef_method(mrb, c, "a");
399+ *
400+ * }
401+ *
402+ * mrb_example_gem_final(mrb_state* mrb){
403+ *
404+ * }
405+ *
406+ * @param mrb_state* The MRuby state reference.
407+ * @param RClass* A class the method will be undefined from.
408+ * @param constchar* The name of the method to be undefined.
409+ */
351410 MRB_API void mrb_undef_method(mrb_state*, struct RClass*, const char*);
352411 MRB_API void mrb_undef_class_method(mrb_state*, struct RClass*, const char*);
353412