Sha256: a8c765296426cc482f4f0699dcfa45534f18245ccfbd119cb4477253061ae1dc
Contents?: true
Size: 866 Bytes
Versions: 15
Compression:
Stored size: 866 Bytes
Contents
# frozen_string_literal: true module Vedeu module Input # Handle input when terminal is in :raw (character at a time) # mode. # # @api private # class Raw # @see Vedeu::Input::Raw#initialize def self.read new.read end # Returns a new instance of Vedeu::Input::Raw. # # @return [Vedeu::Input::Raw] def initialize; end # @return [String] def read keys = console.getch if keys.ord == Vedeu::ESCAPE_KEY_CODE keys << console.read_nonblock(4) rescue nil keys << console.read_nonblock(3) rescue nil keys << console.read_nonblock(2) rescue nil end keys end private # @return [IO] def console @console ||= Vedeu::Terminal.console end end # Raw end # Input end # Vedeu
Version data entries
15 entries across 15 versions & 1 rubygems