Sha256: c126ea225de1f257765c4b52018b0d783fe304254d31f7b1402086b6b346e3a5
Contents?: true
Size: 989 Bytes
Versions: 19
Compression:
Stored size: 989 Bytes
Contents
module Libuv class TTY < Handle include Stream def initialize(loop, fileno, readable) @loop = loop tty_ptr = ::Libuv::Ext.create_handle(:uv_tty) error = check_result(::Libuv::Ext.tty_init(loop.handle, tty_ptr, fileno, readable ? 1 : 0)) super(tty_ptr, error) end def enable_raw_mode return if @closed check_result ::Libuv::Ext.tty_set_mode(handle, 1) end def disable_raw_mode return if @closed check_result ::Libuv::Ext.tty_set_mode(handle, 0) end def reset_mode ::Libuv::Ext.tty_reset_mode end def winsize return [] if @closed width = FFI::MemoryPointer.new(:int) height = FFI::MemoryPointer.new(:int) ::Libuv::Ext.tty_get_winsize(handle, width, height) [width.get_int(0), height.get_int(0)] end end end
Version data entries
19 entries across 19 versions & 1 rubygems