class TextEditor::Reactor
The main event loop for the text editor.
Public Instance Methods
running?()
click to toggle source
# File lib/text_editor/reactor.rb 6 def running? 7 !!@running 8 end
start()
click to toggle source
# File lib/text_editor/reactor.rb 10 def start 11 @running = true 12 render 13 listen 14 end
stop()
click to toggle source
# File lib/text_editor/reactor.rb 16 def stop 17 @running = false 18 end
Private Instance Methods
listen()
click to toggle source
# File lib/text_editor/reactor.rb 22 def listen 23 while running? 24 key = editor.keyboard.listen 25 next unless key 26 27 keybinding, args = editor.mode.resolve(key) 28 resolved = command.resolve(keybinding) 29 next unless resolved 30 31 resolved.call(editor, *args, key.to_s) 32 render 33 end 34 end
render()
click to toggle source
# File lib/text_editor/reactor.rb 36 def render 37 editor.window.render 38 end