Permalink
Browse files

Rename Request#method to #request_method to not confuse stdlibs

darcs-hash:20070218232335-4fc50-728da935ad40a6054a7e46a96fd794984bc6f311.gz
  • Loading branch information...
1 parent e9a1c6b commit a18fc32536b34d74db36517deb8184b82a36f772 @chneukirchen chneukirchen committed Feb 18, 2007
Showing with 17 additions and 17 deletions.
  1. +15 −15 lib/rack/request.rb
  2. +1 −1 lib/rack/showexceptions.rb
  3. +1 −1 test/spec_rack_request.rb
View
@@ -8,21 +8,21 @@ def initialize(env)
@env = env
end
- def body; @env["rack.input"] end
- def scheme; @env["rack.url_scheme"] end
- def script_name; @env["SCRIPT_NAME"].to_s end
- def path_info; @env["PATH_INFO"].to_s end
- def host; @env["HTTP_HOST"] || @env["SERVER_NAME"] end
- def port; @env["SERVER_PORT"].to_i end
- def method; @env["REQUEST_METHOD"] end
-
- def script_name=(s); @env["SCRIPT_NAME"] = s.to_s end
- def path_info=(s); @env["PATH_INFO"] = s.to_s end
-
- def get?; method == "GET" end
- def post?; method == "POST" end
- def put?; method == "PUT" end
- def delete?; method == "DELETE" end
+ def body; @env["rack.input"] end
+ def scheme; @env["rack.url_scheme"] end
+ def script_name; @env["SCRIPT_NAME"].to_s end
+ def path_info; @env["PATH_INFO"].to_s end
+ def host; @env["HTTP_HOST"] || @env["SERVER_NAME"] end
+ def port; @env["SERVER_PORT"].to_i end
+ def request_method; @env["REQUEST_METHOD"] end
+
+ def script_name=(s); @env["SCRIPT_NAME"] = s.to_s end
+ def path_info=(s); @env["PATH_INFO"] = s.to_s end
+
+ def get?; request_method == "GET" end
+ def post?; request_method == "POST" end
+ def put?; request_method == "PUT" end
+ def delete?; request_method == "DELETE" end
def GET
Utils.parse_query(@env["QUERY_STRING"])
@@ -183,7 +183,7 @@ def h(obj)
<td><code><%=h frames.first.filename %></code>: in <code><%=h frames.first.function %></code>, line <%=h frames.first.lineno %></td>
</tr><tr>
<th>Web</th>
- <td><code><%=h req.method %> <%=h(req.host + path)%></code></td>
+ <td><code><%=h req.request_method %> <%=h(req.host + path)%></code></td>
</tr></table>
<h3>Jump to:</h3>
@@ -10,7 +10,7 @@
req.body.should.respond_to? :gets
req.scheme.should.equal "http"
- req.method.should.equal "GET"
+ req.request_method.should.equal "GET"
req.should.be.get
req.should.not.be.post

0 comments on commit a18fc32

Please sign in to comment.