Class: Rios::Terminal
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(fd_master, fd_slave) ⇒ Terminal
constructor
A new instance of Terminal.
- #master ⇒ Object
- #slave ⇒ Object
- #synced(io) ⇒ Object
Constructor Details
#initialize(fd_master, fd_slave) ⇒ Terminal
Returns a new instance of Terminal.
6 7 8 |
# File 'lib/rios/terminal.rb', line 6 def initialize(fd_master, fd_slave) @fd_master, @fd_slave = fd_master, fd_slave end |
Class Method Details
.set_raw_mode(termios) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rios/terminal.rb', line 24 def set_raw_mode(termios) termios.c_iflag &= ~(Termios::IGNBRK | Termios::BRKINT | Termios::PARMRK | Termios::ISTRIP | Termios::INLCR | Termios::IGNCR | Termios::ICRNL | Termios::IXON) termios.c_oflag &= ~Termios::OPOST termios.c_lflag &= ~(Termios::ECHO | Termios::ECHONL | Termios::ICANON | Termios::ISIG | Termios::IEXTEN) termios.c_cflag &= ~(Termios::CSIZE | Termios::PARENB) termios.c_cflag |= Termios::CS8 end |
Instance Method Details
#master ⇒ Object
15 16 17 |
# File 'lib/rios/terminal.rb', line 15 def master synced(@master ||= IO.open(@fd_master)) end |
#slave ⇒ Object
19 20 21 |
# File 'lib/rios/terminal.rb', line 19 def slave synced(@slave ||= IO.open(@fd_slave)) end |
#synced(io) ⇒ Object
10 11 12 13 |
# File 'lib/rios/terminal.rb', line 10 def synced(io) io.sync = true unless io.closed? io end |