Class: Spider::HTTP::Thin

Inherits:
Server show all
Defined in:
lib/spiderfw/http/adapters/thin.rb

Instance Method Summary collapse

Methods inherited from Server

#request_received, #shutdown, #start, start, supports?

Instance Method Details

#options(opts) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/spiderfw/http/adapters/thin.rb', line 12

def options(opts)
    opts = super(opts)
    defaults = {
        :host   => 'localhost',
        :app    => 'spider'
    }
    return defaults.merge(opts)
end

#shutdown_serverObject



31
32
33
# File 'lib/spiderfw/http/adapters/thin.rb', line 31

def shutdown_server
    @server.stop
end

#start_server(opts = {}) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/spiderfw/http/adapters/thin.rb', line 22

def start_server(opts={})
    opts = options(opts)
    options = {
        :Port           => opts[:port],
        :BindAddress    => opts[:host]
    }
    @server = ::Thin::Server.start(opts[:host], opts[:port].to_i, Spider::HTTP::RackApplication.new)
end