Class: Raw::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/raw/adapter.rb

Overview

The base Adapter class. All other adapters extend this class. An adapter conceptually connects Nitro with a Front Web Server. Please notice that many Adapters (for example Webrick and Mongrel implement an ‘inline’ Front Web Server).

The Adapter typically initializes a Handler to handle the http requests.

Direct Known Subclasses

MongrelAdapter, ScriptAdapter, WebrickAdapter

Instance Method Summary collapse

Constructor Details

#initializeAdapter

Initialize the adapter.



28
29
# File 'lib/raw/adapter.rb', line 28

def initialize
end

Instance Method Details

#setup(app) ⇒ Object

Setup the adapter (used as a hook).



33
34
# File 'lib/raw/adapter.rb', line 33

def setup(app)
end

#start(app) ⇒ Object

Start the adapter.



38
39
40
41
42
43
# File 'lib/raw/adapter.rb', line 38

def start(app)
  info "Starting #{self.class.name.demodulize.underscore.humanize} on #{app.address}:#{app.port}"
  info "Press Ctrl-C to shutdown; Run with --help for options."

  setup(app)
end

#stopObject

Stop the adapter.



47
48
49
# File 'lib/raw/adapter.rb', line 47

def stop
  info "Stoping #{self.class.name.demodulize.underscore.humanize}."
end