Class: Rack::Transform::Transformers::Base::Response
- Inherits:
-
Object
- Object
- Rack::Transform::Transformers::Base::Response
- Defined in:
- lib/rack/transform/transformers/base.rb
Constant Summary collapse
- CONTENT_LENGTH =
"Content-Length".freeze
- CONTENT_TYPE =
"Content-Type".freeze
- JSON_TYPE =
"application/json".freeze
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(status, header, body) ⇒ Response
constructor
A new instance of Response.
- #process ⇒ Object
Constructor Details
#initialize(status, header, body) ⇒ Response
63 64 65 66 67 |
# File 'lib/rack/transform/transformers/base.rb', line 63 def initialize(status, header, body) @status = status @header = header.merge CONTENT_TYPE => JSON_TYPE @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
61 62 63 |
# File 'lib/rack/transform/transformers/base.rb', line 61 def body @body end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
61 62 63 |
# File 'lib/rack/transform/transformers/base.rb', line 61 def header @header end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
61 62 63 |
# File 'lib/rack/transform/transformers/base.rb', line 61 def status @status end |
Class Method Details
.call(status, header, body) ⇒ Object
57 58 59 |
# File 'lib/rack/transform/transformers/base.rb', line 57 def self.call(status, header, body) new(status, header, body).process end |
Instance Method Details
#process ⇒ Object
69 70 71 |
# File 'lib/rack/transform/transformers/base.rb', line 69 def process raise NotImplementedError end |