Ruby 2.4.0 リファレンスマニュアル > ライブラリ一覧 > cgi/coreライブラリ > CGIクラス

class CGI

クラス・モジュールの継承リスト: CGI < CGI::QueryExtension < Object < Kernel < BasicObject

要約

CGI スクリプトを書くために必要な機能を提供するクラスです。

特異メソッド

定義 説明
accept_charset -> String

受けとることができるキャラクタセットを文字列で返します。デフォルトは UTF-8 です。

accept_charset=(charset)

受けとることができるキャラクタセットを設定します。

parse(query) -> Hash

与えられたクエリ文字列をパースします。

インスタンスメソッド

定義 説明
accept_charset -> String

受けとることができるキャラクタセットを文字列で返します。デフォルトは UTF-8 です。

header(options = "text/html") -> String

HTTP ヘッダを options に従って生成します。 CGI#out と違い、標準出力には出力しません。 CGI#out を使わずに自力で HTML を出力したい場合などに使います。このメソッドは文字列エンコーディングを変換しません。

nph? -> bool
out(options = "text/html") { .... }

HTTP ヘッダと、ブロックで与えられた文字列を標準出力に出力します。

print(*strings)

@todo

定数

定義 説明
CR -> String

キャリッジリターンを表す文字列です。

EOL -> String

改行文字です。

HTTP_STATUS -> Hash

HTTP のステータスコードを表すハッシュです。

LF -> String

ラインフィードを表す文字列です。

MAX_MULTIPART_COUNT -> Integer

Maximum number of request parameters when multipart

MAX_MULTIPART_LENGTH -> Integer

Maximum content length of multipart data

NEEDS_BINMODE -> bool

ファイルを開くときにバイナリモードが必要かどうかを表す定数です。プラットフォーム依存の定数です。

PATH_SEPARATOR -> Hash

パスの区切り文字を格納します。

継承したメソッド

! != __id__ __send__ instance_eval instance_exec method_missing singleton_method_added singleton_method_removed singleton_method_undefined [] accept accept_encoding accept_language auth_type cache_control content_length content_type cookies cookies= create_body files from gateway_interface has_key? host keys multipart? negotiate params params= path_info path_translated pragma query_string raw_cookie raw_cookie2 referer remote_addr remote_host remote_ident remote_user request_method script_name server_name server_port server_protocol server_software unescape_filename? user_agent !~ <=> == === =~ _dump class clone define_singleton_method display enum_for eql? equal? extend freeze frozen? hash initialize initialize_copy inspect instance_of? instance_variable_defined? instance_variable_get instance_variable_set instance_variables is_a? itself marshal_dump marshal_load method methods nil? object_id pretty_inspect pretty_print pretty_print_cycle pretty_print_inspect pretty_print_instance_variables private_methods protected_methods psych_to_yaml public_method public_methods public_send remove_instance_variable respond_to? respond_to_missing? send singleton_class singleton_method singleton_methods taint tainted? tap to_a to_ary to_hash to_int to_io to_proc to_regexp to_s to_str trust untaint untrust untrusted? .new .yaml_tag ::ARGF ::ARGV ::DATA ::ENV ::FALSE ::NIL ::RUBY_COPYRIGHT ::RUBY_DESCRIPTION ::RUBY_ENGINE ::RUBY_ENGINE_VERSION ::RUBY_PATCHLEVEL ::RUBY_PLATFORM ::RUBY_RELEASE_DATE ::RUBY_REVISION ::RUBY_VERSION ::SCRIPT_LINES__ ::STDERR ::STDIN ::STDOUT ::TOPLEVEL_BINDING ::TRUE

追加されるメソッド

定義 説明 ライブラリ
RFC822_DAYS -> [String]

[RFC822] で定義されている曜日の略称を返します。

cgi/util
RFC822_MONTHS -> [String]

[RFC822] で定義されている月名の略称を返します。

cgi/util
TABLE_FOR_ESCAPE_HTML__ -> Hash

HTML 上でエスケープする文字列の変換テーブルを返します。

cgi/util
escape(string) -> String

与えられた文字列を URL エンコードした文字列を新しく作成し返します。

cgi/util
escapeElement(string, *elements) -> String
escape_element(string, *elements) -> String

第二引数以降に指定したエレメントのタグだけを実体参照に置換します。

cgi/util
escapeHTML(string) -> String
escape_html(string) -> String

与えられた文字列中の '、&、"、<、> を実体参照に置換した文字列を新しく作成し返します。

cgi/util
pretty(string, shift = " ") -> String

HTML を人間に見やすく整形した文字列を返します。

cgi/util
rfc1123_date(time) -> String

与えられた時刻を [RFC1123] フォーマットに準拠した文字列に変換します。

cgi/util
unescape(string) -> String

与えられた文字列を URL デコードした文字列を新しく作成し返します。

cgi/util
unescapeElement(string, *elements) -> String
unescape_element(string, *elements) -> String

特定の要素だけをHTMLエスケープから戻す。

cgi/util
unescapeHTML(string) -> String
unescape_html(string) -> String

与えられた文字列中の実体参照のうち、&amp; &gt; &lt; &quot; と数値指定がされているもの (&#0ffff など) を元の文字列に置換します。

cgi/util