Sha256: f830c2fec4f61551f1f88c73ff6262778d4011707644a16073b4dcfde1c46c2e
Contents?: true
Size: 891 Bytes
Versions: 1
Compression:
Stored size: 891 Bytes
Contents
module Doublespeak class Repl def initialize(data_source, options = {}) raise ArgumentError.new("Must provide a data_source") if data_source.nil? @core = Core.new(data_source, options) end 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 private attr_reader :core end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
doublespeak-0.1.0 | lib/doublespeak/repl.rb |