Class: RBus::Transport::AbstractTransport
- Inherits:
-
Object
- Object
- RBus::Transport::AbstractTransport
show all
- Defined in:
- lib/rbus/bus/transport.rb
Overview
Abstract base implementation of a transport.
Constant Summary
collapse
- CRLF =
"\015\012"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of AbstractTransport.
40
41
42
43
|
# File 'lib/rbus/bus/transport.rb', line 40
def initialize(connection_info)
@connection_info = connection_info
create_socket
end
|
Instance Attribute Details
#socket ⇒ Object
Returns the value of attribute socket.
38
39
40
|
# File 'lib/rbus/bus/transport.rb', line 38
def socket
@socket
end
|
Instance Method Details
#close ⇒ Object
62
63
64
|
# File 'lib/rbus/bus/transport.rb', line 62
def close
@socket.close
end
|
#read(len = 2**27) ⇒ Object
49
50
51
52
|
# File 'lib/rbus/bus/transport.rb', line 49
def read(len = 2**27)
@socket.read(len)
end
|
#readline ⇒ Object
58
59
60
|
# File 'lib/rbus/bus/transport.rb', line 58
def readline
@socket.readline.chomp
end
|
#send(message) ⇒ Object
45
46
47
|
# File 'lib/rbus/bus/transport.rb', line 45
def send(message)
@socket.write(message)
end
|
#sendline(message) ⇒ Object
54
55
56
|
# File 'lib/rbus/bus/transport.rb', line 54
def sendline(message)
@socket.write(message + CRLF)
end
|