Commit a5b416e2 authored by Ralph Desir(Mav7)'s avatar Ralph Desir(Mav7)

Added documentation for mrb_undef_method

parent 6276227e
......@@ -21,7 +21,7 @@ MRuby::Build.new do |conf|
# include the default GEMs
conf.gembox 'default'
conf.gem '/home/thamav/tests/mrbgems_test'
# C compiler settings
# conf.cc do |cc|
# cc.command = ENV['CC'] || 'gcc'
......@@ -82,7 +82,7 @@ MRuby::Build.new do |conf|
# bintest
# conf.enable_bintest
end
=begin
MRuby::Build.new('host-debug') do |conf|
# load specific toolchain settings
......@@ -117,7 +117,7 @@ MRuby::Build.new('test') do |conf|
conf.gembox 'default'
end
=end
# Define cross build settings
# MRuby::CrossBuild.new('32bit') do |conf|
# toolchain :gcc
......
......@@ -243,8 +243,8 @@ MRB_API mrb_value mrb_singleton_class(mrb_state*, mrb_value);
* Include a module in another class or module.
* Equivalent to:
*
* module B *
* include A *
* module B
* include A
* end
* @param mrb_state* The current mruby state.
* @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*,
* @param mrb_value The value for the constant.
*/
MRB_API void mrb_define_const(mrb_state*, struct RClass*, const char *name, mrb_value);
/**
* Undefines a method.
*
* # Ruby style
*
* class A
*
* def a
* "a"
* end
*
* end
*
* A.new.a # => a
*
* class B < A
*
* undef_method :a
*
* end
*
* B.new.a # => undefined method 'a' for B (NoMethodError)
*
* // C style
*
* mrb_value
* mrb_a(mrb_state *mrb){
*
* return mrb_str_new_cstr(mrb, "a");
*
* }
*
* void
* mrb_example_gem_init(mrb_state* mrb){
* struct RClass *a;
* struct RClass *b;
* struct RClass *c;
*
* a = mrb_define_class(mrb, "A", mrb->object_class);
*
* mrb_define_method(mrb, a, "a", mrb_a, MRB_ARGS_NONE());
*
* b = mrb_define_class(mrb, "B", a);
*
* c = mrb_define_class(mrb, "C", b);
*
* mrb_undef_method(mrb, c, "a");
*
* }
*
* mrb_example_gem_final(mrb_state* mrb){
*
* }
*
* @param mrb_state* The MRuby state reference.
* @param RClass* A class the method will be undefined from.
* @param constchar* The name of the method to be undefined.
*/
MRB_API void mrb_undef_method(mrb_state*, struct RClass*, const char*);
MRB_API void mrb_undef_class_method(mrb_state*, struct RClass*, const char*);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment