Class: Biryani::Server
- Inherits:
-
Object
- Object
- Biryani::Server
- Defined in:
- lib/biryani/server.rb
Instance Method Summary collapse
-
#initialize(proc) ⇒ Server
constructor
A new instance of Server.
- #run(socket) ⇒ Object
Constructor Details
#initialize(proc) ⇒ Server
Returns a new instance of Server.
4 5 6 |
# File 'lib/biryani/server.rb', line 4 def initialize(proc) @proc = proc end |
Instance Method Details
#run(socket) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/biryani/server.rb', line 9 def run(socket) loop do Ractor.new(socket.accept, @proc) do |io, proc| conn = Connection.new(proc) conn.serve(io) io.close end end end |