Method: Acter::Response#initialize
- Defined in:
- lib/acter/response.rb
#initialize(status, headers, body) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/acter/response.rb', line 5 def initialize(status, headers, body) @status = status @success = (200..299).include?(status[/\d+/].to_i) @headers = headers.sort.map {|a| a.join(": ") } @body = case body when String @body_is_json = false body else @body_is_json = true MultiJson.dump(body, pretty: true) end end |