aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStormwind <stormwind@stormwinds-page.de>2012-11-24 15:42:08 +0100
committerStormwind <stormwind@stormwinds-page.de>2012-11-24 15:42:08 +0100
commit13eae5cfa5efd6af6e47ea03a58fbb79399a3308 (patch)
tree46e24a62177c1cb5f8c5383f6b3138fd595dc6c4
parent8a75f9462d9a3fd9eaebf37ce530b9c578983438 (diff)
Write some documentation
-rw-r--r--lib/zero/response.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/zero/response.rb b/lib/zero/response.rb
index 22c718b..373a65b 100644
--- a/lib/zero/response.rb
+++ b/lib/zero/response.rb
@@ -16,9 +16,9 @@ module Zero
end
# Sets the status.
- # Also converts every input directly to an integer
+ # Also converts every input directly to an integer.
#
- # @param [Integer] status
+ # @param [Integer] status The status code
#
def status=(status)
@status = status.to_i
@@ -26,9 +26,14 @@ module Zero
# Returns the data of the response as an array:
# [status, header, body]
- # to be usable by any webserver
+ # to be usable by any webserver.
#
- # @return [Array]
+ # Sets the Content-Type to 'text/html', if it's not already set.
+ # Sets the Content-Length, if it's not already set. (Won't fix wrong
+ # lengths!)
+ # Removes Content-Type, Content-Length and body on status code 204 and 304.
+ #
+ # @return [Array] Usable by webservers
#
def to_a
# Remove content length and body, on status 204 and 304
@@ -53,9 +58,11 @@ module Zero
self.header['Content-Length'] = body.join.bytesize
end
- # Sets the content type to the given value
+ # Sets the content type header to the given value
# Also creates it, if it does not exists
#
+ # @param [String] value Content-Type tp set
+ #
def content_type=(value)
self.header['Content-Type'] = value
end