Class: Webmachine::Adapters::Mongrel
- Inherits:
-
Webmachine::Adapter
- Object
- Webmachine::Adapter
- Webmachine::Adapters::Mongrel
- Defined in:
- lib/webmachine/adapters/mongrel.rb
Overview
Connects Webmachine to Mongrel.
Defined Under Namespace
Classes: Handler, RequestBody
Instance Attribute Summary
Attributes inherited from Webmachine::Adapter
Instance Method Summary collapse
-
#run ⇒ Object
Starts the Mongrel adapter.
- #shutdown ⇒ Object
Methods inherited from Webmachine::Adapter
Constructor Details
This class inherits a constructor from Webmachine::Adapter
Instance Method Details
#run ⇒ Object
Starts the Mongrel adapter
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/webmachine/adapters/mongrel.rb', line 15 def run defaults = { :port => configuration.port, :host => configuration.ip, :dispatcher => dispatcher }.merge(configuration.) @config = ::Mongrel::Configurator.new(defaults) do listener do uri '/', :handler => Webmachine::Adapters::Mongrel::Handler.new(defaults[:dispatcher]) end trap("INT") { stop } run end @config.join end |
#shutdown ⇒ Object
31 32 33 34 35 |
# File 'lib/webmachine/adapters/mongrel.rb', line 31 def shutdown # The second argument tells mongrel to block until all listeners are shut down. # This causes the mongrel tests to be very slow, but faster methods cause errors. @config.stop(false, true) if @config end |