Class: Hyperion::Request
- Inherits:
-
Object
- Object
- Hyperion::Request
- Defined in:
- lib/hyperion/request.rb
Overview
Immutable parsed-request value object. Phase 5 (object pooling) will redesign this with explicit reset semantics; for Phase 1 we freeze on construction to prevent accidental mutation.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#http_version ⇒ Object
readonly
Returns the value of attribute http_version.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#peer_address ⇒ Object
readonly
Returns the value of attribute peer_address.
-
#query_string ⇒ Object
readonly
Returns the value of attribute query_string.
Instance Method Summary collapse
- #header(name) ⇒ Object
-
#initialize(method:, path:, query_string:, http_version:, headers:, body:, peer_address: nil) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(method:, path:, query_string:, http_version:, headers:, body:, peer_address: nil) ⇒ Request
Returns a new instance of Request.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/hyperion/request.rb', line 10 def initialize(method:, path:, query_string:, http_version:, headers:, body:, peer_address: nil) @method = method @path = path @query_string = query_string @http_version = http_version @headers = headers.freeze @body = body @peer_address = peer_address freeze end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
8 9 10 |
# File 'lib/hyperion/request.rb', line 8 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
8 9 10 |
# File 'lib/hyperion/request.rb', line 8 def headers @headers end |
#http_version ⇒ Object (readonly)
Returns the value of attribute http_version.
8 9 10 |
# File 'lib/hyperion/request.rb', line 8 def http_version @http_version end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
8 9 10 |
# File 'lib/hyperion/request.rb', line 8 def method @method end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/hyperion/request.rb', line 8 def path @path end |
#peer_address ⇒ Object (readonly)
Returns the value of attribute peer_address.
8 9 10 |
# File 'lib/hyperion/request.rb', line 8 def peer_address @peer_address end |
#query_string ⇒ Object (readonly)
Returns the value of attribute query_string.
8 9 10 |
# File 'lib/hyperion/request.rb', line 8 def query_string @query_string end |
Instance Method Details
#header(name) ⇒ Object
21 22 23 |
# File 'lib/hyperion/request.rb', line 21 def header(name) @headers[name.downcase] end |