Class: Zero::Request::Client
- Inherits:
-
Object
- Object
- Zero::Request::Client
- Defined in:
- lib/zero/request/client.rb
Overview
This class represents all information about the client of a request.
Constant Summary
- KEY_REMOTE_ADDR =
the key for the ip of the client
'REMOTE_ADDR'
- KEY_REMOTE_HOST =
the key for the hostname
'REMOTE_HOST'
- KEY_USER_AGENT =
the key for the user agent
'HTTP_USER_AGENT'
Instance Attribute Summary (collapse)
-
- (String) address
readonly
the ip address of the client.
-
- (String) hostname
readonly
the hostname of the client.
-
- (String) user_agent
readonly
the user agent of the client.
Instance Method Summary (collapse)
-
- (Client) initialize(environment)
constructor
creates a new client with the data of the request environment.
Constructor Details
- (Client) initialize(environment)
creates a new client with the data of the request environment
14 15 16 17 18 |
# File 'lib/zero/request/client.rb', line 14 def initialize(environment) @address = environment[KEY_REMOTE_ADDR] @hostname = environment[KEY_REMOTE_HOST] @user_agent = environment[KEY_USER_AGENT] end |
Instance Attribute Details
- (String) address (readonly)
the ip address of the client
22 23 24 |
# File 'lib/zero/request/client.rb', line 22 def address @address end |
- (String) hostname (readonly)
the hostname of the client
25 26 27 |
# File 'lib/zero/request/client.rb', line 25 def hostname @hostname end |
- (String) user_agent (readonly)
the user agent of the client
28 29 30 |
# File 'lib/zero/request/client.rb', line 28 def user_agent @user_agent end |