better register an instruction view

This commit is contained in:
Torsten Ruger 2015-07-25 21:04:20 +03:00
parent b693f55a29
commit 515e1b106b
2 changed files with 28 additions and 5 deletions

View File

@ -10,10 +10,15 @@ class InstructionView
before_mount do
interpreter.register_event(:instruction_changed, self)
check_active interpreter.instruction
end
def check_active i
active! instruction == i ? "active" : ""
end
def instruction_changed old , ins
active! instruction == ins ? "active" : ""
check_active ins
end
def render

View File

@ -14,12 +14,30 @@ class RegisterView
end
def render
div :class => :row do
div.row do
registers.each do |r , has|
div :class => "col-md-1" do
"#{r} : #{has}"
end
div.col_md_1 do
div.row do
div.col_md_12 do
"#{r} : #{has}"
end
if object = has_object(has)
div.col_md_12 do
object.class.name.split("::").last.span
end
object.get_instance_variables.each do |variable|
div.col_md_12 do
object.get_instance_variable(variable).to_s.span
end
end
end #if
end
end #row
end
end
end
def has_object has
object = Virtual.machine.objects[has]
end
end