integrating the sources to views

This commit is contained in:
Torsten Ruger 2015-07-27 12:09:35 +03:00
parent e460e0041b
commit 7e34ae003e
2 changed files with 20 additions and 3 deletions

View File

@ -18,7 +18,7 @@ class BlockView
def update_block
block_name! interpreter.block.name
codes = interpreter.block.codes.dup
slice = 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

View File

@ -2,13 +2,30 @@ class SourceView
include React::Component
required_param :source, type: Virtual::Instruction
required_param :source
define_state :sources => []
before_update do
text = source_text(source)
return if sources.last == text
sources << text
sources.shift if sources.length > 5
end
def render
div.row do
"Virtual Machine Instruction".br
source.class.name
sources.each do |s|
s.br
end
end
end
def source_text
if source.is_a? Virtual::Instruction
return source.class.name
else
return "Method: #{source.name}"
end
end
end