Class: MPD::Client::Connection
- Inherits:
-
Object
- Object
- MPD::Client::Connection
- Defined in:
- lib/mpd/client/connection.rb
Overview
It’s Client‘s internal class. Don’t use it outside Client
Instance Method Summary collapse
- #connect ⇒ Object
- #gets ⇒ Object
-
#initialize(host:, port:) ⇒ Connection
constructor
A new instance of Connection.
- #puts(text) ⇒ Object
Constructor Details
#initialize(host:, port:) ⇒ Connection
Returns a new instance of Connection.
9 10 11 12 |
# File 'lib/mpd/client/connection.rb', line 9 def initialize(host:, port:) @host = host @port = port end |
Instance Method Details
#connect ⇒ Object
14 15 16 |
# File 'lib/mpd/client/connection.rb', line 14 def connect @socket = TCPSocket.open(host, port) end |
#gets ⇒ Object
23 24 25 26 |
# File 'lib/mpd/client/connection.rb', line 23 def gets raise ConnectionError unless socket socket.gets end |
#puts(text) ⇒ Object
18 19 20 21 |
# File 'lib/mpd/client/connection.rb', line 18 def puts(text) raise ConnectionError unless socket socket.puts(text) end |