Class: WindowBlessing::XtermInput

Inherits:
Object
  • Object
show all
Defined in:
lib/window_blessing/xterm_input.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeXtermInput

Returns a new instance of XtermInput.



6
7
8
# File 'lib/window_blessing/xterm_input.rb', line 6

def initialize
  @event_parser = XtermEventParser.new
end

Instance Attribute Details

#event_parserObject (readonly)

Returns the value of attribute event_parser.



4
5
6
# File 'lib/window_blessing/xterm_input.rb', line 4

def event_parser
  @event_parser
end

Instance Method Details

#read_eventsObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/window_blessing/xterm_input.rb', line 10

def read_events
  events = []
  if raw = read_pending_input
    parsed = event_parser.parse(raw)
    if parsed
      new_events = parsed.events
      events += new_events
      new_events.length
    else
      events << {:type => :event_parser_failure, :raw => raw, :failure_info => event_parser.parser_failure_info}
    end
  end
  events
end