Class: Capybara::Webkit::Server

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

Constant Summary collapse

SERVER_PATH =
File.expand_path("../../../../bin/webkit_server", __FILE__)
WEBKIT_SERVER_START_TIMEOUT =
15

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Server

Returns a new instance of Server.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/capybara/webkit/server.rb', line 12

def initialize(options = {})
  if options.has_key?(:stderr)
    @output_target = options[:stderr]
  elsif options.has_key?(:stdout)
    warn "[DEPRECATION] The Capybara::Webkit::Connection `stdout` " \
      "option is deprecated. Please use `stderr` instead."
    @output_target = options[:stdout]
  else
    @output_target = $stderr
  end
end

Instance Attribute Details

#pidObject (readonly)

Returns the value of attribute pid.



10
11
12
# File 'lib/capybara/webkit/server.rb', line 10

def pid
  @pid
end

#portObject (readonly)

Returns the value of attribute port.



10
11
12
# File 'lib/capybara/webkit/server.rb', line 10

def port
  @port
end

Instance Method Details

#startObject



24
25
26
27
28
29
30
# File 'lib/capybara/webkit/server.rb', line 24

def start
  open_pipe
  discover_port
  discover_pid
  forward_output_in_background_thread
  register_shutdown_hook
end