mrubyを超漢字で動作させる
Revisão | a5b416e2ce31f28ec4c588b3bc1d0b0567faf7ba (tree) |
---|---|
Hora | 2015-10-14 15:50:12 |
Autor | Ralph Desir(Mav7) <battleroundscool@gmai...> |
Commiter | Ralph Desir(Mav7) |
Added documentation for mrb_undef_method
@@ -21,7 +21,7 @@ MRuby::Build.new do |conf| | ||
21 | 21 | |
22 | 22 | # include the default GEMs |
23 | 23 | conf.gembox 'default' |
24 | - | |
24 | + conf.gem '/home/thamav/tests/mrbgems_test' | |
25 | 25 | # C compiler settings |
26 | 26 | # conf.cc do |cc| |
27 | 27 | # cc.command = ENV['CC'] || 'gcc' |
@@ -82,7 +82,7 @@ MRuby::Build.new do |conf| | ||
82 | 82 | # bintest |
83 | 83 | # conf.enable_bintest |
84 | 84 | end |
85 | - | |
85 | +=begin | |
86 | 86 | MRuby::Build.new('host-debug') do |conf| |
87 | 87 | # load specific toolchain settings |
88 | 88 |
@@ -117,7 +117,7 @@ MRuby::Build.new('test') do |conf| | ||
117 | 117 | |
118 | 118 | conf.gembox 'default' |
119 | 119 | end |
120 | - | |
120 | +=end | |
121 | 121 | # Define cross build settings |
122 | 122 | # MRuby::CrossBuild.new('32bit') do |conf| |
123 | 123 | # toolchain :gcc |
@@ -243,8 +243,8 @@ MRB_API mrb_value mrb_singleton_class(mrb_state*, mrb_value); | ||
243 | 243 | * Include a module in another class or module. |
244 | 244 | * Equivalent to: |
245 | 245 | * |
246 | - * module B * | |
247 | - * include A * | |
246 | + * module B | |
247 | + * include A | |
248 | 248 | * end |
249 | 249 | * @param mrb_state* The current mruby state. |
250 | 250 | * @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*, | ||
348 | 348 | * @param mrb_value The value for the constant. |
349 | 349 | */ |
350 | 350 | 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 | + */ | |
351 | 410 | MRB_API void mrb_undef_method(mrb_state*, struct RClass*, const char*); |
352 | 411 | MRB_API void mrb_undef_class_method(mrb_state*, struct RClass*, const char*); |
353 | 412 |