Class: Zero::Request::Parameter

Inherits:
Object
  • Object
show all
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)

Instance Method Summary (collapse)

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).

Parameters:

  • environment (Hash)

    the rack environment



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