From 7b1a58bbae4a479f947087165a3867aea576a53d Mon Sep 17 00:00:00 2001 From: Matthew Stopa Date: Wed, 16 Jan 2013 00:33:08 -0700 Subject: Document ActionDispatch::Response#body method --- actionpack/lib/action_dispatch/http/response.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'actionpack/lib/action_dispatch/http/response.rb') diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 91cf4784db..8760319001 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -172,6 +172,7 @@ module ActionDispatch # :nodoc: stream.to_path end + # Returns the content of the response as a String. def body strings = [] each { |part| strings << part.to_s } -- cgit v1.2.3 From 0004ca3a9725b5c89b671d6f5bcfb245a5800af7 Mon Sep 17 00:00:00 2001 From: Matthew Stopa Date: Wed, 16 Jan 2013 00:48:13 -0700 Subject: More documentation for ActionDispatch::Response [ci skip] --- actionpack/lib/action_dispatch/http/response.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch/http/response.rb') diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 8760319001..15ccfa2735 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -172,7 +172,8 @@ module ActionDispatch # :nodoc: stream.to_path end - # Returns the content of the response as a String. + # Returns the content of the response as a String. This contains the contents + # of any calls to render. def body strings = [] each { |part| strings << part.to_s } @@ -181,6 +182,7 @@ module ActionDispatch # :nodoc: EMPTY = " " + # Allows you to set manually set or override the response body. def body=(body) @blank = true if body == EMPTY -- cgit v1.2.3 From e7ffb5e4e3b9ebedc7a87d32f0cb5c708cde784c Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Wed, 16 Jan 2013 09:26:17 -0200 Subject: Fix typo introduced in 0004ca3a [ci skip] --- actionpack/lib/action_dispatch/http/response.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch/http/response.rb') diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 15ccfa2735..2a146dbb8f 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -182,7 +182,7 @@ module ActionDispatch # :nodoc: EMPTY = " " - # Allows you to set manually set or override the response body. + # Allows you to manually set or override the response body. def body=(body) @blank = true if body == EMPTY -- cgit v1.2.3 From 56498b4b9e2e6092e131ba2b2319345a6712bf94 Mon Sep 17 00:00:00 2001 From: Matthew Stopa Date: Sun, 20 Jan 2013 10:41:02 -0700 Subject: Add documentation to ActionDispatch::Response --- actionpack/lib/action_dispatch/http/response.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'actionpack/lib/action_dispatch/http/response.rb') diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 2a146dbb8f..845fa2ec1f 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -137,6 +137,7 @@ module ActionDispatch # :nodoc: @committed end + # Allows you to set the HTTP status code def status=(status) @status = Rack::Utils.status_code(status) end @@ -155,6 +156,12 @@ module ActionDispatch # :nodoc: @status.to_s end + # Returns the corresponding message for the current HTTP status code + # response.status = 200 + # response.message # => "OK" + # + # response.status = 404 + # response.message # => "Not Found" def message Rack::Utils::HTTP_STATUS_CODES[@status] end -- cgit v1.2.3 From 4313461587254fd8e5b5a8ea7dfc9f0230c70ecb Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 26 Jan 2013 17:36:38 +0100 Subject: generic pass before merging docrails --- actionpack/lib/action_dispatch/http/response.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'actionpack/lib/action_dispatch/http/response.rb') diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 845fa2ec1f..e7e8905d7e 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -137,7 +137,7 @@ module ActionDispatch # :nodoc: @committed end - # Allows you to set the HTTP status code + # Sets the HTTP status code. def status=(status) @status = Rack::Utils.status_code(status) end @@ -146,22 +146,24 @@ module ActionDispatch # :nodoc: @content_type = content_type.to_s end - # The response code of the request + # The response code of the request. def response_code @status end - # Returns a String to ensure compatibility with Net::HTTPResponse + # Returns a string to ensure compatibility with Net::HTTPResponse. def code @status.to_s end - # Returns the corresponding message for the current HTTP status code + # Returns the corresponding message for the current HTTP status code: + # # response.status = 200 # response.message # => "OK" # # response.status = 404 # response.message # => "Not Found" + # def message Rack::Utils::HTTP_STATUS_CODES[@status] end @@ -179,7 +181,7 @@ module ActionDispatch # :nodoc: stream.to_path end - # Returns the content of the response as a String. This contains the contents + # Returns the content of the response as a string. This contains the contents # of any calls to render. def body strings = [] -- cgit v1.2.3