rubyx-debugger/app/block_view.rb

33 lines
637 B
Ruby
Raw Normal View History

2015-07-22 21:05:31 +02:00
require "source_view"
2015-07-22 21:05:31 +02:00
class BlockView
include React::Component
2015-07-23 19:08:40 +02:00
required_param :interpreter
2015-07-22 21:05:31 +02:00
before_mount do
interpreter.register_event(event: :block_changed, listener: self, callback: :block_changed)
end
def block_changed block
block! block
end
2015-07-22 21:05:31 +02:00
def render
div.row do
div.col_md_5 do
2015-07-23 19:08:40 +02:00
SourceView :source => interpreter.block.codes.first.source
end
div.col_md_5 do
2015-07-23 19:08:40 +02:00
interpreter.block.codes.each do |code|
code.to_s.br
end
2015-07-22 21:05:31 +02:00
end
div.col_md_2 do
button.btn.btn_default { "next" }.on(:click) { interpreter.tick }
end
2015-07-22 21:05:31 +02:00
end
end
end