Class: ChromeRemote::Socket

Inherits:
Object
  • Object
show all
Defined in:
lib/chrome_remote/socket.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#ioObject (readonly)

Returns the value of attribute io.



5
6
7
# File 'lib/chrome_remote/socket.rb', line 5

def io
  @io
end

#urlObject (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

#readObject



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