Class: Praxis::Handlers::WWWForm
- Inherits:
-
Object
- Object
- Praxis::Handlers::WWWForm
- Defined in:
- lib/praxis/handlers/www_form.rb
Instance Method Summary collapse
-
#generate(structured_data) ⇒ Object
Generate a URL-encoded WWW form from structured data.
-
#initialize ⇒ WWWForm
constructor
A new instance of WWWForm.
-
#parse(entity) ⇒ Object
Parse a URL-encoded WWW form into structured data.
Constructor Details
#initialize ⇒ WWWForm
Returns a new instance of WWWForm.
11 12 13 |
# File 'lib/praxis/handlers/www_form.rb', line 11 def initialize require 'rack' # superfluous, but might as well be safe end |
Instance Method Details
#generate(structured_data) ⇒ Object
Generate a URL-encoded WWW form from structured data. Not implemented since this format is not very useful for a response body.
22 23 24 25 26 |
# File 'lib/praxis/handlers/www_form.rb', line 22 def generate(structured_data) return nil if structured_data.nil? URI.encode_www_form(structured_data) end |
#parse(entity) ⇒ Object
Parse a URL-encoded WWW form into structured data.
16 17 18 |
# File 'lib/praxis/handlers/www_form.rb', line 16 def parse(entity) ::Rack::Utils.parse_nested_query(entity) end |