try to get object recursion going
This commit is contained in:
parent
a779daf205
commit
f942ed719a
29
app/main/controllers/objects_controller.rb
Normal file
29
app/main/controllers/objects_controller.rb
Normal file
@ -0,0 +1,29 @@
|
||||
module Main
|
||||
class ObjectsController < Volt::ModelController
|
||||
|
||||
def marker var
|
||||
return "Wo" if var.is_a? String
|
||||
var.class.name.split("::").last[0,2]
|
||||
end
|
||||
|
||||
def content(id)
|
||||
object = Virtual.machine.objects[id]
|
||||
fields = []
|
||||
if object and ! object.is_a?(String)
|
||||
clazz = object.class.name.split("::").last
|
||||
fields << ["#{clazz}:#{object.internal_object_length}" , 0]
|
||||
fields << ["--------------------" , 0 ]
|
||||
object.get_instance_variables.each do |variable|
|
||||
f = object.get_instance_variable(variable)
|
||||
fields << ["#{variable} : #{marker(f)} : #{f.object_id}" , f.object_id]
|
||||
end
|
||||
end
|
||||
fields
|
||||
end
|
||||
|
||||
def is_object?( id )
|
||||
Virtual.machine.objects[id] != nil
|
||||
end
|
||||
|
||||
end
|
||||
end
|
16
app/main/views/objects/index.html
Normal file
16
app/main/views/objects/index.html
Normal file
@ -0,0 +1,16 @@
|
||||
<:Title>
|
||||
objects index
|
||||
|
||||
<:Body>
|
||||
<li>
|
||||
<a href="#">{{attrs.object}}</a>
|
||||
{{ if(is_object?(attrs.id) and (attrs.level < 4)) }}
|
||||
<ul>
|
||||
{{content(attrs.id).each do |con3| }}
|
||||
<li>
|
||||
<a href="#">{{con3[0]}}</a>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</li>
|
@ -21,7 +21,7 @@
|
||||
{{ if is_object?( con[1])}}
|
||||
<ul>
|
||||
{{content(con[1]).each do |con2| }}
|
||||
<:object object={{con2[0]}} id={{con2[1]}} level={{3}} />
|
||||
<:objects object={{con2[0]}} id={{con2[1]}} level={{3}} />
|
||||
{{end}}
|
||||
</ul>
|
||||
{{ end }}
|
||||
@ -35,17 +35,3 @@
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<:Object>
|
||||
<li>
|
||||
<a href="#">{{attrs.object}}</a>
|
||||
{{ if(is_object?(attrs.id) and (attrs.level < 4)) }}
|
||||
<ul>
|
||||
{{content(attrs.id).each do |con3| }}
|
||||
<li>
|
||||
<a href="#">{{con3[0]}}</a>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</li>
|
||||
|
5
spec/app/main/integration/objects_spec.rb
Normal file
5
spec/app/main/integration/objects_spec.rb
Normal file
@ -0,0 +1,5 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe '', type: :feature do
|
||||
# Specs here
|
||||
end
|
Loading…
Reference in New Issue
Block a user