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)
fields << RefView.new( variable , f.object_id , @z )
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
fields
end

View File

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