Skip to content
Browse files
Fix Module#define_method
When defining a method through a proc which gets created out of a method
which is defined in a C-ext, `meth.ruby_method.executable` is a instance of
Rubinius::NativeCode and not Rubinius::CompiledCode which does not
respond to #scope.

This is used for example in pg gem:
  • Loading branch information
tak1n committed Feb 5, 2016
1 parent 40f04c1 commit d43625161f4cd3d0acccea77c6b13ed160f06267
Showing 1 changed file with 5 additions and 1 deletion.
@@ -446,7 +446,11 @@ def define_method(name, meth = undefined, &prc)
when Proc
if meth.ruby_method
code =, :call, meth, false)
scope = meth.ruby_method.executable.scope
if meth.ruby_method.executable.kind_of? Rubinius::CompiledCode
scope = meth.ruby_method.executable.scope
scope = nil
be = meth.block.dup
be.change_name name

0 comments on commit d436251

Please sign in to comment.