Skip to content

Commit

Permalink
Module#instance_method unwraps CompiledMethod::Visibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Ford committed Oct 27, 2008
1 parent a755f9c commit de42669
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/bootstrap/compiled_method.rb
@@ -1,4 +1,4 @@
class CompiledMethod
class CompiledMethod < Executable

def self.allocate
Ruby.primitive :compiledmethod_allocate
Expand Down
5 changes: 5 additions & 0 deletions kernel/common/compiled_method.rb
Expand Up @@ -117,6 +117,11 @@ def to_s
end

class CompiledMethod < Executable
class Visibility
attr_accessor :method
attr_reader :visibility
end

# Ivars: instance_variables, primitive, serial, name, iseq, stack_size,
# local_count, required_args, total_args, splat, literals, exceptions,
# lines, file, compiled, scope
Expand Down
3 changes: 3 additions & 0 deletions kernel/common/module.rb
Expand Up @@ -336,6 +336,9 @@ def instance_method(name)
cmethod = mod.method_table[name]
end

# unwrap the real method from Visibility if needed
cmethod = cmethod.method if cmethod.kind_of? CompiledMethod::Visibility

# We want to show the real module
mod = mod.module if mod.class == IncludedModule
return UnboundMethod.new(mod, cmethod, self) if cmethod
Expand Down

0 comments on commit de42669

Please sign in to comment.