Class: Doublespeak::Repl
- Inherits:
-
Object
- Object
- Doublespeak::Repl
- Defined in:
- lib/doublespeak/repl.rb
Instance Method Summary collapse
-
#initialize(data_source, options = {}) ⇒ Repl
constructor
A new instance of Repl.
- #run ⇒ Object
Constructor Details
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/doublespeak/repl.rb', line 8 def run continue = true while continue core.render core.display.set_cursor_visible(core.query.empty?) char = core.display.read case char when "\r" if core.saved_candidates.present? continue = false core.finish_up end when "\e[A" core.increment_selection(-1) when "\e[B" core.increment_selection(+1) when "\u007F" core.back_up core.find_candidates when /^[a-zA-Z0-9 ]/ core.entry(char) core.find_candidates end end end |