| Module | CGI::QueryExtension |
| In: |
cgi.rb
|
Mixin module. It provides the follow functionality groups:
- Access to CGI environment variables as methods. See documentation to the CGI class for a list of these variables.
- Access to cookies, including the cookies attribute.
- Access to parameters, including the params attribute, and overloading
- to perform parameter value lookup by key.
- The initialize_query method, for initialising the above mechanisms, handling multipart forms, and allowing the class to be used in "offline" mode.
Methods
External Aliases
| path | -> | local_path |
Attributes
Public Instance methods
Get the value for the parameter with a given key.
If the parameter has multiple values, only the first will be retrieved; use params() to get the array of values.
# File cgi.rb, line 1159
1159: def [](key)
1160: params = @params[key]
1161: value = params[0]
1162: if @multipart
1163: if value
1164: return value
1165: elsif defined? StringIO
1166: StringIO.new("")
1167: else
1168: Tempfile.new("CGI")
1169: end
1170: else
1171: str = if value then value.dup else "" end
1172: str.extend(Value)
1173: str.set_params(params)
1174: str
1175: end
1176: end
Returns true if a given parameter key exists in the query.
# File cgi.rb, line 1184
1184: def has_key?(*args)
1185: @params.has_key?(*args)
1186: end
Return all parameter keys as an array.
# File cgi.rb, line 1179
1179: def keys(*args)
1180: @params.keys(*args)
1181: end
Get the raw cookies as a string.
# File cgi.rb, line 945
945: def raw_cookie
946: env_table["HTTP_COOKIE"]
947: end