Class: Cuprum::Rails::Responses::HeadResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/cuprum/rails/responses/head_response.rb

Overview

Encapsulates a response without a response body.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:) ⇒ HeadResponse

Returns a new instance of HeadResponse.

Parameters:

  • status (Integer)

    the HTTP status of the response.



9
10
11
# File 'lib/cuprum/rails/responses/head_response.rb', line 9

def initialize(status:)
  @status = status
end

Instance Attribute Details

#statusInteger (readonly)

Returns the HTTP status of the response.

Returns:

  • (Integer)

    the HTTP status of the response.



14
15
16
# File 'lib/cuprum/rails/responses/head_response.rb', line 14

def status
  @status
end

Instance Method Details

#call(renderer) ⇒ Object

Calls the renderer’s #head method with the configured status.

Parameters:

  • renderer (#render)

    The context for executing the response, such as a Rails controller.



20
21
22
# File 'lib/cuprum/rails/responses/head_response.rb', line 20

def call(renderer)
  renderer.head(status)
end