module CGI::QueryExtension
Mixin module that provides the following:
-
Access to the CGI environment variables as methods. See documentation to the CGI class for a list of these variables. The methods are exposed by removing the leading
HTTP_(if it exists) and downcasing the name. For example,auth_typewill return the environment variableAUTH_TYPE, andacceptwill return the value forHTTP_ACCEPT. -
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_querymethod, for initializing the above mechanisms, handling multipart forms, and allowing the class to be used in "offline" mode.
Public Instance Methods
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 684
def []: (String key) -> String?
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 vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 686
def accept: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 688
def accept_charset: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 690
def accept_encoding: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 692
def accept_language: () -> String?
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 694
def auth_type: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 696
def cache_control: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 698
def content_length: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 700
def content_type: () -> String?
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 712
def create_body: (boolish is_large) -> (Tempfile | StringIO)
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 717
def files: () -> Hash[String, Tempfile | StringIO]
Get the uploaded files as a hash of name=>values pairs
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 719
def from: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 721
def gateway_interface: () -> String?
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 729
def has_key?: (String key) -> bool
Returns true if a given query string parameter exists.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 731
def host: () -> String?
() → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 840
def initialize_query: () -> void
A wrapper class to use a StringIO object as the body and switch to a TempFile when the passed threshold is passed. Initialize the data from the query.
Handles multipart forms (in particular, forms that involve file uploads). Reads query parameters in the @params field, and cookies into @cookies.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 753
def keys: () -> Array[String]
Return all query parameter names as an array of String.
() → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 761
def multipart?: () -> bool
Returns whether the form contained multipart/form-data
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 763
def negotiate: () -> String?
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 768
def params: () -> Hash[String, Array[String] | Tempfile | StringIO]
Get the parameters as a hash of name=>values pairs, where values is an Array.
(Hash[String, Array[String] | Tempfile | StringIO] hash) → Hash[String, Array[String] | Tempfile | StringIO]
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 776
def params=: (Hash[String, Array[String] | Tempfile | StringIO] hash) -> Hash[String, Array[String] | Tempfile | StringIO]
Set all the parameters.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 778
def path_info: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 780
def path_translated: () -> String?
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 782
def pragma: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 784
def query_string: () -> String?
() → String
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 848
def read_from_cmdline: () -> String
offline mode. read name=value pairs on standard input.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 862
def read_multipart: (String boundary, Integer content_length) -> (Tempfile | StringIO)
Parses multipart form elements according to www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2
Returns a hash of multipart form parameters with bodies of type StringIO or Tempfile depending on whether the multipart form element exceeds 10 KB
params[name => body]
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 802
def referer: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 804
def remote_addr: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 806
def remote_host: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 808
def remote_ident: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 810
def remote_user: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 812
def request_method: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 814
def script_name: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 816
def server_name: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 818
def server_port: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 820
def server_protocol: () -> String?
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 822
def server_software: () -> String?
() → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 824
def unescape_filename?: () -> bool
() → String?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/cgi/0/core.rbs, line 826
def user_agent: () -> String?