rubyx-debugger/app/instruction_view.rb

29 lines
443 B
Ruby
Raw Normal View History

2015-07-25 14:28:59 +02:00
class InstructionView
include React::Component
required_param :interpreter
required_param :instruction
define_state :active => ""
before_mount do
2015-07-25 20:04:20 +02:00
check_active interpreter.instruction
2015-07-25 14:28:59 +02:00
end
2015-07-25 20:04:20 +02:00
def check_active i
active! instruction == i ? "bright" : ""
2015-07-25 20:04:20 +02:00
end
2015-07-25 14:28:59 +02:00
def instruction_changed old , ins
2015-07-25 20:04:20 +02:00
check_active ins
2015-07-25 14:28:59 +02:00
end
def render
div :class => active do
instruction.to_s if instruction
2015-07-25 14:28:59 +02:00
end
end
end