rubyx-debugger/lib/class_view.rb

49 lines
1.1 KiB
Ruby
Raw Normal View History

2015-08-22 01:06:48 +02:00
class ClassView < ListView
2015-08-20 00:53:20 +02:00
2015-08-20 19:40:47 +02:00
def initialize interpreter
@interpreter = interpreter
@classes = []
2015-08-20 00:53:20 +02:00
Virtual.machine.space.classes.each do |name , claz|
next if [:Kernel,:Module,:MetaClass,:BinaryCode].index name
@classes << claz
2015-08-20 00:53:20 +02:00
end
@classes.sort! {|a,b| a.name <=> b.name }
2015-08-20 00:53:20 +02:00
end
2015-08-20 14:48:45 +02:00
def draw
2015-08-22 01:06:48 +02:00
create_element(".classes") << div("h4" , "Classes")
list = add("ul.nav!")
@classes.each do |cl|
list << (div("li") <<
(div( "a" , cl.name ) <<
(ul = div("ul"))))
cl.object_layout.object_instance_names.each do |name|
ul << (div("li") << div("a", name ))
end
end
return @element
2015-08-20 19:40:47 +02:00
DOM do |dom|
dom.div.classes do
dom.h4 {"Classes"}
dom.ul.nav! do
@classes.each do |cl|
dom.li do
dom.a { cl.name }
dom.ul do
cl.object_layout.object_instance_names.each do |name|
dom.li do
dom.a{ name }
end
end
end
2015-08-20 19:40:47 +02:00
end
end
2015-08-20 14:48:45 +02:00
end
end
end
end
2015-08-20 00:53:20 +02:00
end