serve 1.5.0.pre → 1.5.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,6 +1,7 @@
1
1
  = Change Log
2
2
 
3
3
  == edge
4
+ * Modified params helper to work with POST params in addition to GET. Closes #19. [jlong]
4
5
  * Added an export command which allows you to convert a Serve site to static HTML. Closes #10. [jlong]
5
6
 
6
7
  == 1.1.1 (June 7, 2011)
data/README.rdoc CHANGED
@@ -285,7 +285,7 @@ email :: Evaluates the document as if it is an e-mail message; the format is ide
285
285
  redirect :: Redirects to the URL contained in the document
286
286
 
287
287
 
288
- == Exporting A Serve Project
288
+ == Exporting a Serve Project
289
289
 
290
290
  The edge version of Serve now has limited support for exporting your Serve
291
291
  project to HTML. To get started with the prerelease version:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.0.pre
1
+ 1.5.0.pre2
data/lib/serve/rack.rb CHANGED
@@ -4,8 +4,23 @@ require 'rack'
4
4
  module Serve
5
5
  class Request < Rack::Request
6
6
  # Returns a Hash of the query params for a request's URL.
7
- def query
8
- @query ||= Rack::Utils.parse_nested_query(query_string)
7
+ def get_params
8
+ @get_params ||= Rack::Utils.parse_nested_query(query_string)
9
+ end
10
+ alias query get_params
11
+
12
+ # Returns a Hash of the query params for a posted form
13
+ def post_params
14
+ @post_params ||= form_data? ? Rack::Utils.parse_nested_query(body.read) : {}
15
+ end
16
+
17
+ # Key based access to query parameters. Keys can be strings or symbols.
18
+ def params
19
+ @params ||= begin
20
+ hash = HashWithIndifferentAccess.new.update(get_params)
21
+ hash.update(post_params) if form_data?
22
+ hash
23
+ end
9
24
  end
10
25
 
11
26
  # Returns the protocol part of the URL for a request: "http://", "https://", etc.
@@ -96,7 +96,7 @@ module Serve #:nodoc:
96
96
 
97
97
  # Key based access to query parameters. Keys can be strings or symbols.
98
98
  def params
99
- @params ||= HashWithIndifferentAccess.new(request.query)
99
+ @params ||= request.params
100
100
  end
101
101
 
102
102
  # Extract the value for a bool param. Handy for rendering templates in
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serve
3
3
  version: !ruby/object:Gem::Version
4
- hash: 961916028
4
+ hash: -1876988199
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
9
  - 0
10
- - pre
11
- version: 1.5.0.pre
10
+ - pre2
11
+ version: 1.5.0.pre2
12
12
  platform: ruby
13
13
  authors:
14
14
  - John W. Long
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-06-07 00:00:00 -04:00
21
+ date: 2011-06-08 00:00:00 -04:00
22
22
  default_executable: serve
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency