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 collapse
- 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
-
#hostname ⇒ String
readonly
get the hostname of the server.
-
#port ⇒ Numeric
readonly
get the port.
-
#protocol ⇒ String
readonly
get the protocol of the server (normally it should be HTTP/1.1).
-
#software ⇒ String
readonly
get the server software.
Instance Method Summary collapse
-
#initialize(environment) ⇒ Server
constructor
This creates a new server instance extracting all server related information from the environment.
Constructor Details
#initialize(environment) ⇒ Server
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
#hostname ⇒ String (readonly)
get the hostname of the server
32 33 34 |
# File 'lib/zero/request/server.rb', line 32 def hostname @hostname end |
#port ⇒ Numeric (readonly)
get the port
29 30 31 |
# File 'lib/zero/request/server.rb', line 29 def port @port end |
#protocol ⇒ String (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 |
#software ⇒ String (readonly)
get the server software
38 39 40 |
# File 'lib/zero/request/server.rb', line 38 def software @software end |