Commit ccaf3e35 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2303 from ksss/module-initialize

Module#initialize set created object for block argument
parents 267eb74a 0bd8e487
......@@ -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;
}
......
......@@ -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
......
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