From 515e1b106bb63a8d91c7a77985d3950315c19bdd Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sat, 25 Jul 2015 21:04:20 +0300 Subject: [PATCH] better register an instruction view --- app/instruction_view.rb | 7 ++++++- app/register_view.rb | 26 ++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/app/instruction_view.rb b/app/instruction_view.rb index e8b01b9..a59f126 100644 --- a/app/instruction_view.rb +++ b/app/instruction_view.rb @@ -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 diff --git a/app/register_view.rb b/app/register_view.rb index 8dbad70..61aa8f4 100644 --- a/app/register_view.rb +++ b/app/register_view.rb @@ -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