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

class CGI

クラスの継承リスト: CGI < CGI::QueryExtension < Object < Kernel

要約

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

特異メソッド

定義 説明
escape(string) -> String

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

escapeElement(string, *elements) -> String

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

escapeHTML(string) -> String

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

parse(query) -> Hash

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

pretty(string, shift = " ") -> String

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

rfc1123_date(time) -> String

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

unescape(string) -> String

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

unescapeElement(string, *element) -> String

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

unescapeHTML(string) -> String

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

インスタンスメソッド

定義 説明
header(options = "text/html") -> String

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

out(options = "text/html") { .... }

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

print(*strings)

引数の文字列を標準出力に出力します。 cgi.print は $DEFAULT_OUTPUT.print と等価です。

定数

定義 説明
CR -> String

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

EOL -> String

改行文字です。

HTTP_STATUS -> Hash

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

LF -> String

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

PATH_SEPARATOR -> Hash

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

RFC822_DAYS -> [String]

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

RFC822_MONTHS -> [String]

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

継承したメソッド

[] accept accept_charset accept_encoding accept_language auth_type cache_control content_length content_type cookies cookies= 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 user_agent == === =~ __id__ __send__ _dump class clone dclone display enum_for eql? equal? extend freeze frozen? hash initialize initialize_copy inspect instance_eval instance_exec instance_of? instance_variable_defined? instance_variable_get instance_variable_set instance_variables is_a? marshal_dump marshal_load method method_missing methods nil? pretty_inspect pretty_print pretty_print_cycle pretty_print_inspect pretty_print_instance_variables private_methods protected_methods public_methods remove_instance_variable respond_to? singleton_method_added singleton_method_removed singleton_method_undefined singleton_methods taint tainted? tap to_a to_ary to_hash to_int to_io to_proc to_regexp to_s to_str to_yaml to_yaml_properties to_yaml_style untaint .new