1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm_method.c (rb_add_method, rb_add_method_me): call method added

hook after definition.  [ruby-core:25536]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-09-12 15:03:02 +00:00
parent 797749c219
commit d7feab06cc
4 changed files with 36 additions and 5 deletions

View file

@ -755,4 +755,23 @@ class TestModule < Test::Unit::TestCase
c = eval("class C\u{df}; self; end")
assert_equal("TestModule::C\u{df}", c.name, '[ruby-core:24600]')
end
def test_method_added
memo = []
mod = Module.new do
mod = self
(class << self ; self ; end).class_eval do
define_method :method_added do |sym|
memo << sym
memo << mod.instance_methods(false)
memo << (mod.instance_method(sym) rescue nil)
end
end
def f
end
end
assert_equal :f, memo.shift
assert_equal mod.instance_methods(false), memo.shift
assert_equal mod.instance_method(:f), memo.shift
end
end