Class: RackStep::Response
- Inherits:
-
Rack::Response
- Object
- Rack::Response
- RackStep::Response
- Defined in:
- lib/rackstep.rb
Overview
Let’s extend the Rack Response class to add a few methods to make the life of the developer a little easier.
Instance Method Summary collapse
-
#body=(value) ⇒ Object
The original body= method of Rack::Response expects an array.
- #content_type ⇒ Object
- #content_type=(value) ⇒ Object
Instance Method Details
#body=(value) ⇒ Object
The original body= method of Rack::Response expects an array. In RackStep the user may set it as a String and we will convert it to array if necessary.
80 81 82 83 84 85 86 87 |
# File 'lib/rackstep.rb', line 80 def body=(value) if value.is_a?(String) # Convert it to an array. value = [value] end super(value) end |
#content_type ⇒ Object
89 90 91 |
# File 'lib/rackstep.rb', line 89 def content_type header['Content-Type'] end |
#content_type=(value) ⇒ Object
93 94 95 |
# File 'lib/rackstep.rb', line 93 def content_type=(value) header['Content-Type'] = value end |