Class: Capybara::Driver::Webkit::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/capybara/driver/webkit/connection.rb

Constant Summary collapse

WEBKIT_SERVER_START_TIMEOUT =
15

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Connection

Returns a new instance of Connection.



11
12
13
14
15
16
17
18
# File 'lib/capybara/driver/webkit/connection.rb', line 11

def initialize(options = {})
  @socket_class = options[:socket_class] || TCPSocket
  @stdout       = options.has_key?(:stdout) ?
                    options[:stdout] :
                    $stdout
  start_server
  connect
end

Instance Attribute Details

#portObject (readonly)

Returns the value of attribute port.



9
10
11
# File 'lib/capybara/driver/webkit/connection.rb', line 9

def port
  @port
end

Instance Method Details

#getsObject



28
29
30
# File 'lib/capybara/driver/webkit/connection.rb', line 28

def gets
  @socket.gets
end


24
25
26
# File 'lib/capybara/driver/webkit/connection.rb', line 24

def print(string)
  @socket.print string
end

#puts(string) ⇒ Object



20
21
22
# File 'lib/capybara/driver/webkit/connection.rb', line 20

def puts(string)
  @socket.puts string
end

#read(length) ⇒ Object



32
33
34
# File 'lib/capybara/driver/webkit/connection.rb', line 32

def read(length)
  @socket.read(length)
end