Class: Tipi::Listener

Inherits:
Object
  • Object
show all
Defined in:
lib/tipi/controller/web_stock.rb

Instance Method Summary collapse

Constructor Details

#initialize(server, &handler) ⇒ Listener

Returns a new instance of Listener.



12
13
14
15
# File 'lib/tipi/controller/web_stock.rb', line 12

def initialize(server, &handler)
  @server = server
  @handler = handler
end

Instance Method Details

#acceptObject



17
18
19
20
# File 'lib/tipi/controller/web_stock.rb', line 17

def accept
  socket, _addrinfo = @server.accept
  @handler.call(socket)
end