diff --git a/app/block_view.rb b/app/block_view.rb index 74f274c..49ae27b 100644 --- a/app/block_view.rb +++ b/app/block_view.rb @@ -18,7 +18,8 @@ class BlockView def update_block block_name! interpreter.block.name codes = interpreter.block.codes.dup - codes.shift while( codes.index(interpreter.instruction) > 1 ) + slice = codes.index(interpreter.instruction) - 1 + codes.shift( slice ) if slice >= 0 codes.pop while(codes.length > 4) block! codes end diff --git a/app/instruction_view.rb b/app/instruction_view.rb index a59f126..a9da7c8 100644 --- a/app/instruction_view.rb +++ b/app/instruction_view.rb @@ -9,7 +9,6 @@ class InstructionView define_state :active => "" before_mount do - interpreter.register_event(:instruction_changed, self) check_active interpreter.instruction end diff --git a/app/register_view.rb b/app/register_view.rb index 839c79f..b3d0234 100644 --- a/app/register_view.rb +++ b/app/register_view.rb @@ -26,9 +26,10 @@ class RegisterView has_fields = [] clazz = object.class.name.split("::").last puts "found #{clazz}" - has_fields << clazz + has_fields << clazz object.get_instance_variables.each do |variable| - has_fields << object.get_instance_variable(variable).to_s + f = object.get_instance_variable(variable) + has_fields << f end fields! has_fields end @@ -39,12 +40,15 @@ class RegisterView div.col_md_12 do objects_id.to_s end - fields.each do |variable| + fields.each do |attribute| div.col_md_12 do - variable.span + "#{marker(attribute)} - #{attribute.object_id}".span end end end end + def marker var + var.class.name.split("::").last[0] + end end