Class: Linzer::Message::Adapter::Rack::Response
- Includes:
- Common
- Defined in:
- lib/linzer/message/adapter/rack/response.rb
Overview
Adapter for Rack::Response objects.
Instance Method Summary collapse
-
#attach!(signature) ⇒ ::Rack::Response
Attaches a signature to the response.
-
#header(name) ⇒ String?
Retrieves a header value by name.
-
#initialize(operation, **options) ⇒ Response
constructor
Creates a new Rack response adapter.
Methods inherited from Abstract
#[], #attached_request?, #field?, #request?, #response?
Constructor Details
#initialize(operation, **options) ⇒ Response
Creates a new Rack response adapter.
15 16 17 18 19 20 21 22 |
# File 'lib/linzer/message/adapter/rack/response.rb', line 15 def initialize(operation, **) @operation = operation validate attached_request = [:attached_request] @attached_request = attached_request ? Message.new(attached_request) : nil validate_attached_request @attached_request if @attached_request freeze end |
Instance Method Details
#attach!(signature) ⇒ ::Rack::Response
Attaches a signature to the response.
34 35 36 37 38 39 |
# File 'lib/linzer/message/adapter/rack/response.rb', line 34 def attach!(signature) signature.to_h.each do |h, v| @operation.set_header(h, v) end @operation end |
#header(name) ⇒ String?
Retrieves a header value by name.
27 28 29 |
# File 'lib/linzer/message/adapter/rack/response.rb', line 27 def header(name) @operation.get_header(name) end |