23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/wri/server.rb', line 23
def heirarchy
ns = NS.new(nil)
service.names.each do |m|
if m.index('#')
type = :instance
space, method = m.split('#')
spaces = space.split('::').collect{|s| s.to_sym }
method = method.to_sym
elsif m.index('::')
type = :class
space, method = m.split('::')
spaces = space.split('::').collect{|s| s.to_sym }
if spaces.last =~ /^[a-z]/
method = spaces.pop
else
next end
else
next end
memo = ns
spaces.each do |space|
memo[space] ||= NS.new(space, memo)
memo = memo[space]
end
if type == :class
memo.class_methods << method
else
memo.instance_methods << method
end
end
return ns
end
|