Class: Hokaido::Server
- Inherits:
-
Object
- Object
- Hokaido::Server
- Includes:
- Celluloid
- Defined in:
- lib/hokaido/server.rb
Instance Method Summary collapse
-
#initialize(host, port) ⇒ Server
constructor
A new instance of Server.
- #run ⇒ Object
- #shutdown ⇒ Object
Constructor Details
#initialize(host, port) ⇒ Server
Returns a new instance of Server.
51 52 53 54 55 |
# File 'lib/hokaido/server.rb', line 51 def initialize(host, port) @server = TCPServer.new(host, port) async.run end |
Instance Method Details
#run ⇒ Object
61 62 63 64 65 |
# File 'lib/hokaido/server.rb', line 61 def run loop do ConnectionHandler.new(@server.accept).link Actor.current end end |
#shutdown ⇒ Object
57 58 59 |
# File 'lib/hokaido/server.rb', line 57 def shutdown @server.close if @server end |