From 2645f54d5bfdc97ca86e7e29037e3b47ccb67a03 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Thu, 23 Jul 2015 13:20:53 +0300 Subject: [PATCH] move registers to hash --- app/register_view.rb | 6 +++--- lib/interpreter.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/register_view.rb b/app/register_view.rb index 12ff640..a6449d7 100644 --- a/app/register_view.rb +++ b/app/register_view.rb @@ -1,13 +1,13 @@ class RegisterView include React::Component - required_param :registers, type: [] + required_param :registers, type: {} def render div :class => :row do - registers.each do |r| + registers.each do |r , has| div :class => "col-md-1" do - r + "#{r} : #{has}" end end end diff --git a/lib/interpreter.rb b/lib/interpreter.rb index 0543bad..aadf341 100644 --- a/lib/interpreter.rb +++ b/lib/interpreter.rb @@ -5,6 +5,6 @@ class Interpreter attr_accessor :registers def initialize - @registers = (0...12).collect{|i| "r#{i}"} + @registers = Hash[(0...12).collect{|i| ["r#{i}" , "undefined"]}] end end