Class: Capybara::Poltergeist::Server
- Inherits:
-
Object
- Object
- Capybara::Poltergeist::Server
- Defined in:
- lib/capybara/poltergeist/server.rb
Instance Attribute Summary collapse
-
#fixed_port ⇒ Object
readonly
Returns the value of attribute fixed_port.
-
#socket ⇒ Object
readonly
Returns the value of attribute socket.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize(fixed_port = nil, timeout = nil) ⇒ Server
constructor
A new instance of Server.
- #port ⇒ Object
- #restart ⇒ Object
- #send(message) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(fixed_port = nil, timeout = nil) ⇒ Server
Returns a new instance of Server.
5 6 7 8 9 |
# File 'lib/capybara/poltergeist/server.rb', line 5 def initialize(fixed_port = nil, timeout = nil) @fixed_port = fixed_port @timeout = timeout start end |
Instance Attribute Details
#fixed_port ⇒ Object (readonly)
Returns the value of attribute fixed_port.
3 4 5 |
# File 'lib/capybara/poltergeist/server.rb', line 3 def fixed_port @fixed_port end |
#socket ⇒ Object (readonly)
Returns the value of attribute socket.
3 4 5 |
# File 'lib/capybara/poltergeist/server.rb', line 3 def socket @socket end |
#timeout ⇒ Object
Returns the value of attribute timeout.
3 4 5 |
# File 'lib/capybara/poltergeist/server.rb', line 3 def timeout @timeout end |
Instance Method Details
#port ⇒ Object
11 12 13 |
# File 'lib/capybara/poltergeist/server.rb', line 11 def port @socket.port end |
#restart ⇒ Object
27 28 29 30 |
# File 'lib/capybara/poltergeist/server.rb', line 27 def restart stop start end |
#send(message) ⇒ Object
32 33 34 |
# File 'lib/capybara/poltergeist/server.rb', line 32 def send() @socket.send() or raise DeadClient.new() end |
#start ⇒ Object
19 20 21 |
# File 'lib/capybara/poltergeist/server.rb', line 19 def start @socket = WebSocketServer.new(fixed_port, timeout) end |
#stop ⇒ Object
23 24 25 |
# File 'lib/capybara/poltergeist/server.rb', line 23 def stop @socket.close end |