class Chamomile::InputReader
Background thread that reads stdin and feeds bytes through EscapeParser.
Public Class Methods
Source
# File lib/chamomile/input_reader.rb, line 8 def initialize(queue, input: $stdin) @queue = queue @input = input @thread = nil @running = false @parser = EscapeParser.new end
Public Instance Methods
Source
# File lib/chamomile/input_reader.rb, line 16 def start return @thread if @running @running = true @thread = Thread.new { read_loop } @thread.abort_on_exception = false @thread end
Source
# File lib/chamomile/input_reader.rb, line 25 def stop @running = false return unless @thread @thread.join(1) @thread = nil end