Method: ActionDispatch::Response#initialize

Defined in:
actionpack/lib/action_dispatch/http/response.rb

#initialize(status = 200, headers = nil, body = []) {|_self| ... } ⇒ Response

Returns a new instance of Response.

Yields:

  • (_self)

Yield Parameters:



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'actionpack/lib/action_dispatch/http/response.rb', line 197

def initialize(status = 200, headers = nil, body = [])
  super()

  @headers = Headers.new

  headers&.each do |key, value|
    @headers[key] = value
  end

  self.body, self.status = body, status

  @cv           = new_cond
  @committed    = false
  @sending      = false
  @sent         = false

  prepare_cache_control!

  yield self if block_given?
end