Class: Looksee::Adapter::Rubinius
- Inherits:
-
Base
- Object
- Base
- Looksee::Adapter::Rubinius
show all
- Defined in:
- lib/looksee/adapter/rubinius.rb
Instance Method Summary
collapse
Methods inherited from Base
#describe_module, #internal_class, #lookup_modules
Instance Method Details
#internal_class_to_module(internal_class) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/looksee/adapter/rubinius.rb', line 11
def internal_class_to_module(internal_class)
if internal_class.is_a?(::Rubinius::IncludedModule)
internal_class.module
else
internal_class
end
end
|
#internal_private_instance_methods(mod) ⇒ Object
27
28
29
|
# File 'lib/looksee/adapter/rubinius.rb', line 27
def internal_private_instance_methods(mod)
mod.method_table.private_names
end
|
#internal_protected_instance_methods(mod) ⇒ Object
23
24
25
|
# File 'lib/looksee/adapter/rubinius.rb', line 23
def internal_protected_instance_methods(mod)
mod.method_table.protected_names
end
|
#internal_public_instance_methods(mod) ⇒ Object
19
20
21
|
# File 'lib/looksee/adapter/rubinius.rb', line 19
def internal_public_instance_methods(mod)
mod.method_table.public_names
end
|
#internal_superclass(klass) ⇒ Object
7
8
9
|
# File 'lib/looksee/adapter/rubinius.rb', line 7
def internal_superclass(klass)
klass.direct_superclass
end
|
#internal_undefined_instance_methods(mod) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/looksee/adapter/rubinius.rb', line 31
def internal_undefined_instance_methods(mod)
names = []
mod.method_table.each_entry do |entry|
names << entry.name if entry.visibility.equal?(:undef)
end
names
end
|
#module_name(mod) ⇒ Object
49
50
51
52
53
|
# File 'lib/looksee/adapter/rubinius.rb', line 49
def module_name(mod)
mod.is_a?(Module) or
raise TypeError, "expected module, got #{mod.class}"
mod.__name__
end
|
#singleton_class?(object) ⇒ Boolean
39
40
41
|
# File 'lib/looksee/adapter/rubinius.rb', line 39
def singleton_class?(object)
object.is_a?(Class) && object.__metaclass_object__
end
|
#singleton_instance(singleton_class) ⇒ Object
43
44
45
46
47
|
# File 'lib/looksee/adapter/rubinius.rb', line 43
def singleton_instance(singleton_class)
singleton_class?(singleton_class) or
raise TypeError, "expected singleton class, got #{singleton_class.class}"
singleton_class.__metaclass_object__
end
|
#source_location(method) ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/looksee/adapter/rubinius.rb', line 55
def source_location(method)
method.is_a?(UnboundMethod) or
raise TypeError, "expected UnboundMethod, got #{method.class}"
source_location = method.source_location and
return source_location
case (executable = method.executable)
when ::Rubinius::BlockEnvironment::AsMethod
method = executable.instance_variable_get(:@block_env).method
[method.file.to_s, method.lines[1]]
when ::Rubinius::DelegatedMethod
executable.instance_variable_get(:@receiver).source_location
end
end
|