Class: SWS::Adaptor::Generic
- Inherits:
-
Object
- Object
- SWS::Adaptor::Generic
- Defined in:
- lib/sws/adaptor.rb
Overview
Base class for all adaptors
Direct Known Subclasses
Constant Summary collapse
- HEADER_TRANSLATION =
Header translation hash - defines how the env variables are named in request.headers TODO: add missing headers
{ "HTTP_USER_AGENT" => "user-agent", "HTTP_HOST" => "host", "HTTP_COOKIE" => "cookie", "CONTENT_LENGTH" => "content-length", "CONTENT_TYPE" => "content-type", "REMOTE_ADDR" => "remote-address" }
Instance Attribute Summary collapse
-
#base_path ⇒ Object
readonly
Base path of the adaptor.
Instance Method Summary collapse
-
#each_request ⇒ Object
Main adaptor method - invokes block for each received request.
-
#initialize ⇒ Generic
constructor
A new instance of Generic.
-
#run ⇒ Object
Start the adaptor.
Constructor Details
#initialize ⇒ Generic
Returns a new instance of Generic.
32 33 34 |
# File 'lib/sws/adaptor.rb', line 32 def initialize () raise "Adaptor::Generic cannot be instantiated - override and don't call super" end |
Instance Attribute Details
#base_path ⇒ Object (readonly)
Base path of the adaptor
30 31 32 |
# File 'lib/sws/adaptor.rb', line 30 def base_path @base_path end |
Instance Method Details
#each_request ⇒ Object
Main adaptor method - invokes block for each received request. Custom adaptors should override this method and shouldn’t call super
46 47 48 |
# File 'lib/sws/adaptor.rb', line 46 def each_request () raise "Override and do not call super for Adaptor.each_request" end |
#run ⇒ Object
Start the adaptor. Custom adaptors should override this method and shouldn’t call super
39 40 41 |
# File 'lib/sws/adaptor.rb', line 39 def run () raise "Override and do not call super for Adaptor.run" end |