Class: CMUX::Channel
- Inherits:
-
Object
- Object
- CMUX::Channel
- Defined in:
- lib/cmux/channel.rb
Instance Attribute Summary collapse
-
#device ⇒ Object
readonly
Returns the value of attribute device.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(device, port, mux) ⇒ Channel
constructor
A new instance of Channel.
- #open(&block) ⇒ Object
Constructor Details
#initialize(device, port, mux) ⇒ Channel
Returns a new instance of Channel.
6 7 8 9 10 |
# File 'lib/cmux/channel.rb', line 6 def initialize(device, port, mux) @device = device @port = port @mux = mux end |
Instance Attribute Details
#device ⇒ Object (readonly)
Returns the value of attribute device.
3 4 5 |
# File 'lib/cmux/channel.rb', line 3 def device @device end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
4 5 6 |
# File 'lib/cmux/channel.rb', line 4 def port @port end |
Instance Method Details
#close ⇒ Object
25 26 27 |
# File 'lib/cmux/channel.rb', line 25 def close @mux.close_port @port end |
#open(&block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cmux/channel.rb', line 12 def open(&block) io = IO.open_tty @device if block_given? begin yield io ensure io.close end else io end end |