Parent

Included Modules

Class Index [+]

Quicksearch

Cucumber::WireSupport::Connection

Public Class Methods

new(config) click to toggle source
    # File lib/cucumber/wire_support/connection.rb, line 11
11:       def initialize(config)
12:         @config = config
13:       end

Public Instance Methods

call_remote(request_handler, message, params) click to toggle source
    # File lib/cucumber/wire_support/connection.rb, line 15
15:       def call_remote(request_handler, message, params)
16:         packet = WirePacket.new(message, params)
17: 
18:         begin
19:           send_data_to_socket(packet.to_json)
20:           response = fetch_data_from_socket(@config.timeout(message))
21:           response.handle_with(request_handler)
22:         rescue Timeout::Error => e
23:           backtrace = e.backtrace ; backtrace.shift # because Timeout puts some wierd stuff in there
24:           raise Timeout::Error, "Timed out calling wire server with message '#{message}'", backtrace
25:         end
26:       end
exception(params) click to toggle source
    # File lib/cucumber/wire_support/connection.rb, line 28
28:       def exception(params)
29:         WireException.new(params, @config.host, @config.port)
30:       end

Private Instance Methods

fetch_data_from_socket(timeout) click to toggle source
    # File lib/cucumber/wire_support/connection.rb, line 38
38:       def fetch_data_from_socket(timeout)
39:         raw_response = 
40:           if timeout == :never
41:             socket.gets
42:           else
43:             Timeout.timeout(timeout) { socket.gets }
44:           end
45:         WirePacket.parse(raw_response)
46:       end
send_data_to_socket(data) click to toggle source
    # File lib/cucumber/wire_support/connection.rb, line 34
34:       def send_data_to_socket(data)
35:         Timeout.timeout(@config.timeout) { socket.puts(data) }
36:       end
socket() click to toggle source
    # File lib/cucumber/wire_support/connection.rb, line 48
48:       def socket
49:         @socket ||= TCPSocket.new(@config.host, @config.port)
50:       rescue Errno::ECONNREFUSED => exception
51:         raise(ConnectionError, "Unable to contact the wire server at #{@config.host}:#{@config.port}. Is it up?")
52:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.