Class: ChromeRemote::Socket
- Inherits:
-
Object
- Object
- ChromeRemote::Socket
- Defined in:
- lib/chrome_remote/socket.rb
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ Socket
constructor
A new instance of Socket.
- #read ⇒ Object
- #write(data) ⇒ Object
Constructor Details
#initialize(url) ⇒ Socket
Returns a new instance of Socket.
7 8 9 10 11 12 |
# File 'lib/chrome_remote/socket.rb', line 7 def initialize(url) uri = URI.parse(url) @url = url @io = TCPSocket.new(uri.host, uri.port) end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
5 6 7 |
# File 'lib/chrome_remote/socket.rb', line 5 def io @io end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/chrome_remote/socket.rb', line 5 def url @url end |
Instance Method Details
#read ⇒ Object
18 19 20 |
# File 'lib/chrome_remote/socket.rb', line 18 def read io.readpartial(1024) end |
#write(data) ⇒ Object
14 15 16 |
# File 'lib/chrome_remote/socket.rb', line 14 def write(data) io.print data end |