Class: Kamerling::Server::HTTP
- Inherits:
-
Object
- Object
- Kamerling::Server::HTTP
- Defined in:
- lib/kamerling/server/http.rb
Instance Attribute Summary collapse
-
#addr ⇒ Object
readonly
Returns the value of attribute addr.
Instance Method Summary collapse
-
#initialize(addr:) ⇒ HTTP
constructor
A new instance of HTTP.
- #join ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(addr:) ⇒ HTTP
Returns a new instance of HTTP.
9 10 11 |
# File 'lib/kamerling/server/http.rb', line 9 def initialize(addr:) @addr = addr end |
Instance Attribute Details
#addr ⇒ Object (readonly)
Returns the value of attribute addr.
7 8 9 |
# File 'lib/kamerling/server/http.rb', line 7 def addr @addr end |
Instance Method Details
#join ⇒ Object
13 14 15 |
# File 'lib/kamerling/server/http.rb', line 13 def join thread.join end |
#start ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/kamerling/server/http.rb', line 17 def start @thread = Thread.new do Rack::Handler::WEBrick.run HTTPAPI, Host: addr.host, Port: addr.port end loop { break if addr.connectable? } self end |
#stop ⇒ Object
25 26 27 |
# File 'lib/kamerling/server/http.rb', line 25 def stop thread.exit.join end |