better block view

This commit is contained in:
Torsten Ruger 2015-07-26 09:04:34 +03:00
parent 515e1b106b
commit 3464e50b2f
2 changed files with 19 additions and 8 deletions

View File

@ -7,26 +7,35 @@ class BlockView
include React::Component
required_param :interpreter
define_state :block
define_state :block => []
define_state :block_name => ""
before_mount do
interpreter.register_event(:block_changed, self)
block! interpreter.block
interpreter.register_event(:instruction_changed, self)
update_block
end
def block_changed old , bl
block! bl
def update_block
block_name! interpreter.block.name
codes = interpreter.block.codes.dup
codes.shift while( codes.index(interpreter.instruction) > 1 )
codes.pop while(codes.length > 4)
block! codes
end
def instruction_changed
update_block
end
def render
return unless block
div.row do
div.col_md_5 do
SourceView :source => block.codes.first.source
SourceView :source => interpreter.instruction.source
end
div.col_md_5 do
h6 { "Block: #{block.name}"}
block.codes.each do |code|
h6 { "Block: #{block_name}"}
block.each do |code|
InstructionView :interpreter => interpreter , :instruction => code
end
end

View File

@ -27,6 +27,8 @@ class RegisterView
end
object.get_instance_variables.each do |variable|
div.col_md_12 do
## deal with String
## even better, make ObjectView
object.get_instance_variable(variable).to_s.span
end
end