Class: Adelnor::Response
- Inherits:
-
Object
- Object
- Adelnor::Response
- Defined in:
- lib/adelnor/response.rb
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(status, headers, body) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(status, headers, body) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 |
# File 'lib/adelnor/response.rb', line 5 def initialize(status, headers, body) @status = status @headers = headers @body = body.respond_to?(:first) ? body.first : body end |
Class Method Details
.build(*args) ⇒ Object
11 12 13 |
# File 'lib/adelnor/response.rb', line 11 def self.build(*args) new(*args).build end |
Instance Method Details
#build ⇒ Object
15 16 17 |
# File 'lib/adelnor/response.rb', line 15 def build "HTTP/2.0 #{@status}\r\n#{headers_as_string}\r\n#{@body}" end |