class SnowmanIO::WebServer
Attributes
app[R]
Public Class Methods
new(app, options)
click to toggle source
Calls superclass method
# File lib/snowman-io/web_server.rb, line 89 def initialize(app, options) raise ArgumentError, "no host given" unless options[:host] raise ArgumentError, "no port given" unless options[:port] SnowmanIO.logger.info "Snowman WebServer started on http://#{options[:host]}:#{options[:port]}" # TODO: not sure, maybe should log without verbose option too app = Rack::CommonLogger.new(app, STDOUT) if options[:verbose] super(options[:host], options[:port], &method(:on_connection)) @app = app end
Public Instance Methods
on_connection(connection)
click to toggle source
# File lib/snowman-io/web_server.rb, line 102 def on_connection(connection) # connection.detach ConnectionHandler.new(connection, @app) end