rubyx-debugger/app/status_view.rb

42 lines
692 B
Ruby
Raw Normal View History

2015-07-28 15:16:09 +02:00
class StatusView
include React::Component
required_param :interpreter
define_state :state => "starting"
define_state :stdout
before_mount do
interpreter.register_event(:instruction_changed, self)
end
def update_state
state! interpreter.state
stdout! interpreter.stdout
end
def instruction_changed old , nex
update_state
end
def render
div.status_view do
div do
2015-07-28 15:35:45 +02:00
button.bright { "next" }.on(:click) { interpreter.tick }
2015-07-28 15:16:09 +02:00
" ".br
end
div do
h4 {"Status:"}
state.to_s.br
end
div do
h4 {"Stdout:"}
end
div do
interpreter.stdout.br
end
end
end
end