Class: Webmachine::Adapters::WEBrick

Inherits:
Webmachine::Adapter show all
Defined in:
lib/webmachine/adapters/webrick.rb

Overview

Connects Webmachine to WEBrick.

Defined Under Namespace

Classes: Server

Instance Attribute Summary

Attributes inherited from Webmachine::Adapter

#configuration, #dispatcher

Instance Method Summary collapse

Methods inherited from Webmachine::Adapter

#initialize, run

Constructor Details

This class inherits a constructor from Webmachine::Adapter

Instance Method Details

#runObject

Starts the WEBrick adapter



14
15
16
17
18
19
20
21
22
# File 'lib/webmachine/adapters/webrick.rb', line 14

def run
  options = {
    :Port => configuration.port,
    :BindAddress => configuration.ip
  }.merge(configuration.adapter_options)
  server = Webmachine::Adapters::WEBrick::Server.new(dispatcher, options)
  trap("INT"){ server.shutdown }
  Thread.new { server.start }.join
end