diff options
| -rw-r--r-- | src/class.c | 2 | ||||
| -rw-r--r-- | test/t/module.rb | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/class.c b/src/class.c index 5c5aa52f0..44d415f0c 100644 --- a/src/class.c +++ b/src/class.c @@ -897,7 +897,7 @@ mrb_mod_initialize(mrb_state *mrb, mrb_value mod) mrb_get_args(mrb, "&", &b); if (!mrb_nil_p(b)) { - mrb_yield_with_class(mrb, b, 0, 0, mod, mrb_class_ptr(mod)); + mrb_yield_with_class(mrb, b, 1, &mod, mod, mrb_class_ptr(mod)); } return mod; } diff --git a/test/t/module.rb b/test/t/module.rb index 806824b70..fcf46fe3a 100644 --- a/test/t/module.rb +++ b/test/t/module.rb @@ -344,6 +344,9 @@ assert('Module#initialize', '15.2.2.4.31') do assert_kind_of Module, Module.new mod = Module.new { def hello; "hello"; end } assert_equal [:hello], mod.instance_methods + a = nil + mod = Module.new { |m| a = m } + assert_equal mod, a end assert('Module#instance_methods', '15.2.2.4.33') do |
