Skip to content
Permalink
Browse files
raise TypeError if meth does not respond to :for_define_method
  • Loading branch information
tak1n committed Feb 5, 2016
1 parent 3f9756b commit 510919d64010382a016646f38b97fafd807639ce
Showing with 5 additions and 1 deletion.
  1. +5 −1 core/module.rb
@@ -442,7 +442,11 @@ def define_method(name, meth = undefined, &prc)

name = Rubinius::Type.coerce_to_symbol name

code, scope = meth.for_define_method(name, self.class)
if meth.respond_to?(:for_define_method)
code, scope = meth.for_define_method(name, self.class)
else
raise TypeError, "wrong argument type #{meth.class} (expected Proc/Method)"
end

Rubinius.add_method name, code, self, scope, 0, :public

0 comments on commit 510919d

Please sign in to comment.