Class: Zero::Request::Parameter
- Inherits:
-
Object
- Object
- Zero::Request::Parameter
- Defined in:
- lib/zero/request/parameter.rb
Overview
represents all parameter set in a session
This class holds all parameters available in the rack environment, split on query and payload parameters.
Constant Summary
- ENV_KEY_QUERY =
they key for the query string
'QUERY_STRING'
- ENV_KEY_PAYLOAD =
the key for the payload
'rack.input'
- ENV_KEY_CONTENT_TYPE =
the key for the content type
'CONTENT_TYPE'
- PAYLOAD_CONTENT_TYPES =
all content types which used for using the body as a parameter input
[ 'application/x-www-form-urlencoded', 'multipart/form-data' ].to_set
Instance Attribute Summary (collapse)
-
- (Object) payload
(also: #post)
readonly
get the payload or form data parameters.
-
- (Object) query
(also: #get)
readonly
get the query parameters.
Instance Method Summary (collapse)
-
- (Parameter) initialize(environment)
constructor
creates a new parameter instance.
Constructor Details
- (Parameter) initialize(environment)
creates a new parameter instance
This should never be called directly, as it will be generated for you. This instance gives you the options to get query parameters (mostly called GET parameters) and payload parameters (or POST parameters).
37 38 39 40 |
# File 'lib/zero/request/parameter.rb', line 37 def initialize(environment) @query = extract_query_params(environment) @payload = extract_payload_params(environment) end |
Instance Attribute Details
- (Object) payload (readonly) Also known as: post
get the payload or form data parameters
28 29 30 |
# File 'lib/zero/request/parameter.rb', line 28 def payload @payload end |
- (Object) query (readonly) Also known as: get
get the query parameters
24 25 26 |
# File 'lib/zero/request/parameter.rb', line 24 def query @query end |