rubyx-debugger/lib/views/classes_view.rb

38 lines
819 B
Ruby
Raw Normal View History

class ClassesView < ListView
def initialize interpreter
@interpreter = interpreter
classes = []
2015-10-27 11:44:02 +01:00
Register.machine.space.classes.each do |name , claz|
next if [:Kernel,:Module,:MetaClass,:BinaryCode].index name
classes << claz
end
classes.sort! {|a,b| a.name <=> b.name }
super( classes.collect{|c| ClassView.new(c)})
end
def draw
super()
wrap_element div("ul.nav!")
wrap_element( div("h4" , "Classes") )
return @element
end
end
2015-08-24 01:49:41 +02:00
class ClassView < ElementView
def initialize clazz
@clazz = clazz
end
def draw
@element = div("li") << div( "a" , @clazz.name ) << (ul = div("ul"))
2015-10-27 11:44:02 +01:00
@clazz.object_layout.instance_names.each do |name|
2015-08-24 01:49:41 +02:00
ul << (div("li") << div("a", name ))
end
@element.style["z-index"] = 20
@element
end
end