Class: Zero::Request::Server
- Inherits:
-
Object
- Object
- Zero::Request::Server
- Defined in:
- lib/zero/request/server.rb
Overview
This class represents all server related information of a request.
Constant Summary
- KEY_SERVER_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
the key for the server name
'SERVER_NAME'
- KEY_SERVER_PORT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
the key for the server port
'SERVER_PORT'
- KEY_SERVER_PROTOCOL =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
the key for the server protocol
'SERVER_PROTOCOL'
- KEY_SERVER_SOFTWARE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
the key for the server software
'SERVER_SOFTWARE'
Instance Attribute Summary (collapse)
-
- (String) hostname
readonly
get the hostname of the server.
-
- (Numeric) port
readonly
get the port.
-
- (String) protocol
readonly
get the protocol of the server (normally it should be HTTP/1.1).
-
- (String) software
readonly
get the server software.
Instance Method Summary (collapse)
-
- (Server) initialize(environment)
constructor
This creates a new server instance extracting all server related.
Constructor Details
- (Server) initialize(environment)
This creates a new server instance extracting all server related
information from the environment.
20 21 22 23 24 25 |
# File 'lib/zero/request/server.rb', line 20 def initialize(environment) @hostname = environment[KEY_SERVER_NAME] @port = environment[KEY_SERVER_PORT].to_i @protocol = environment[KEY_SERVER_PROTOCOL] @software = environment[KEY_SERVER_SOFTWARE] end |
Instance Attribute Details
- (String) hostname (readonly)
get the hostname of the server
32 33 34 |
# File 'lib/zero/request/server.rb', line 32 def hostname @hostname end |
- (Numeric) port (readonly)
get the port
29 30 31 |
# File 'lib/zero/request/server.rb', line 29 def port @port end |
- (String) protocol (readonly)
get the protocol of the server (normally it should be HTTP/1.1)
35 36 37 |
# File 'lib/zero/request/server.rb', line 35 def protocol @protocol end |
- (String) software (readonly)
get the server software
38 39 40 |
# File 'lib/zero/request/server.rb', line 38 def software @software end |