Sha256: 16d8230f089a122f56ce5fe9a89e5ec8c6fd656f9df5714515830b39c18719ec

Contents?: true

Size: 606 Bytes

Versions: 15

Compression:

Stored size: 606 Bytes

Contents

module Capybara::Poltergeist
  class Server
    attr_reader :socket, :fixed_port, :timeout

    def initialize(fixed_port = nil, timeout = nil)
      @fixed_port = fixed_port
      @timeout    = timeout
      start
    end

    def port
      @socket.port
    end

    def timeout=(sec)
      @timeout = @socket.timeout = sec
    end

    def start
      @socket = WebSocketServer.new(fixed_port, timeout)
    end

    def stop
      @socket.close
    end

    def restart
      stop
      start
    end

    def send(message)
      @socket.send(message) or raise DeadClient.new(message)
    end
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
poltergeist-1.7.0 lib/capybara/poltergeist/server.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/poltergeist-1.6.0/lib/capybara/poltergeist/server.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/poltergeist-1.6.0/lib/capybara/poltergeist/server.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/poltergeist-1.6.0/lib/capybara/poltergeist/server.rb
poltergeist-1.6.0 lib/capybara/poltergeist/server.rb
poltergeist-cj-1.5.2 lib/capybara/poltergeist/server.rb
poltergeist-1.5.1 lib/capybara/poltergeist/server.rb
poltergeist-1.5.0 lib/capybara/poltergeist/server.rb
poltergeist-1.4.1 lib/capybara/poltergeist/server.rb
poltergeist-1.4.0 lib/capybara/poltergeist/server.rb
poltergeist-1.1.2 lib/capybara/poltergeist/server.rb
poltergeist-1.3.0 lib/capybara/poltergeist/server.rb
poltergeist-1.1.1 lib/capybara/poltergeist/server.rb
poltergeist-1.2.0 lib/capybara/poltergeist/server.rb
poltergeist-1.1.0 lib/capybara/poltergeist/server.rb