From c0bdfe149c79a25ce797bec4e9131e7d4c714503 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Tue, 25 Aug 2015 11:54:44 +0200 Subject: [PATCH] fix list and string views --- lib/object_view.rb | 7 +++++++ lib/ref_view.rb | 23 +++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/object_view.rb b/lib/object_view.rb index 0e62cea..1cd64de 100644 --- a/lib/object_view.rb +++ b/lib/object_view.rb @@ -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 diff --git a/lib/ref_view.rb b/lib/ref_view.rb index eb587d9..e243c9f 100644 --- a/lib/ref_view.rb +++ b/lib/ref_view.rb @@ -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