Class: Webmachine::Adapter Abstract

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

Overview

This class is abstract.

Subclass and override #run to implement a custom adapter.

The abstract class for definining a Webmachine adapter.

Direct Known Subclasses

Webmachine::Adapters::Mongrel, Webmachine::Adapters::Rack, Webmachine::Adapters::WEBrick

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Adapter) initialize(configuration, dispatcher)

configuration.

Parameters:



17
18
19
20
# File 'lib/webmachine/adapter.rb', line 17

def initialize(configuration, dispatcher)
  @configuration = configuration
  @dispatcher    = dispatcher
end

Instance Attribute Details

- (Webmachine::Configuration) configuration (readonly)

The application's configuration.

Returns:



9
10
11
# File 'lib/webmachine/adapter.rb', line 9

def configuration
  @configuration
end

- (Webmachine::Dispatcher) dispatcher (readonly)

The application's dispatcher.

Returns:



12
13
14
# File 'lib/webmachine/adapter.rb', line 12

def dispatcher
  @dispatcher
end

Class Method Details

+ (Object) run(configuration, dispatcher)

Create a new adapter and run it.



23
24
25
# File 'lib/webmachine/adapter.rb', line 23

def self.run(configuration, dispatcher)
  new(configuration, dispatcher).run
end

Instance Method Details

- (Object) run

This method is abstract.

Subclass and override #run to implement a custom adapter.

Start the adapter.

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/webmachine/adapter.rb', line 31

def run
  raise NotImplementedError
end