fix list and string views

This commit is contained in:
Torsten Ruger 2015-08-25 11:54:44 +02:00
parent 5ec7ea6d56
commit c0bdfe149c
2 changed files with 24 additions and 6 deletions

View File

@ -40,6 +40,13 @@ class ObjectView < ListView
f = object.get_instance_variable(variable) f = object.get_instance_variable(variable)
fields << RefView.new( variable , f.object_id , @z ) fields << RefView.new( variable , f.object_id , @z )
end end
if( object.is_a?(Parfait::List) )
index = 1
object.each do | o , i|
fields << RefView.new( index.to_s , o.object_id , @z )
index += 1
end
end
end end
fields fields
end end

View File

@ -22,11 +22,20 @@ class RefView < ListView
end end
def add_hover def add_hover
return if is_string?
@element.on("hover"){ hover } if is_object?(@value) @element.on("hover"){ hover } if is_object?(@value)
end end
def is_object?( id ) def is_object?( )
Virtual.machine.objects[id] != nil Virtual.machine.objects[@value] != nil
end
def is_string?()
Virtual.machine.objects[@value].is_a? String
end
def is_nil?()
Virtual.machine.objects[@value].nil?
end end
def hover def hover
@ -36,13 +45,15 @@ class RefView < ListView
end end
def marker id def marker id
var = Virtual.machine.objects[id] if is_string?
if var.is_a? String str = @value
str = "Wo" elsif is_nil?
str = "nil"
else else
var = Virtual.machine.objects[id]
str = var.class.name.split("::").last[0,2] str = var.class.name.split("::").last[0,2]
str + " : #{id.to_s}"
end end
str + " : #{id.to_s}"
end end
end end