Class: Rpremote::Terminal
- Inherits:
-
Object
- Object
- Rpremote::Terminal
- Defined in:
- lib/rpremote/terminal.rb,
sig/rpremote.rbs
Constant Summary collapse
- EXIT_BYTE =
0x1D- BUFFER_SIZE =
4096
Instance Attribute Summary collapse
-
#input ⇒ IO
readonly
Returns the value of attribute input.
-
#output ⇒ IO
readonly
Returns the value of attribute output.
-
#serial_io ⇒ Object
readonly
Returns the value of attribute serial_io.
Instance Method Summary collapse
-
#initialize(serial_io, input: $stdin, output: $stdout, selector: nil) ⇒ Terminal
constructor
A new instance of Terminal.
- #run(exit_sequence: nil) ⇒ nil
Constructor Details
#initialize(serial_io, input: $stdin, output: $stdout, selector: nil) ⇒ Terminal
Returns a new instance of Terminal.
12 13 14 15 16 17 |
# File 'lib/rpremote/terminal.rb', line 12 def initialize(serial_io, input: $stdin, output: $stdout, selector: nil) @serial_io = serial_io @input = input @output = output @selector = selector || ->(readers) { IO.select(readers) } end |
Instance Attribute Details
#input ⇒ IO (readonly)
Returns the value of attribute input.
10 11 12 |
# File 'lib/rpremote/terminal.rb', line 10 def input @input end |
#output ⇒ IO (readonly)
Returns the value of attribute output.
10 11 12 |
# File 'lib/rpremote/terminal.rb', line 10 def output @output end |
#serial_io ⇒ Object (readonly)
Returns the value of attribute serial_io.
10 11 12 |
# File 'lib/rpremote/terminal.rb', line 10 def serial_io @serial_io end |
Instance Method Details
#run(exit_sequence: nil) ⇒ nil
19 20 21 22 23 |
# File 'lib/rpremote/terminal.rb', line 19 def run(exit_sequence: nil) with_raw_input { relay } ensure leave_interactive_mode(exit_sequence) end |