Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > 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)

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

定数

定義 説明
CR -> String

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

EOL -> String

改行文字です。

HTTP_STATUS -> Hash

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

LF -> String

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

MAX_MULTIPART_COUNT -> Fixnum

Maximum number of request parameters when multipart

MAX_MULTIPART_LENGTH -> Fixnum

Maximum content length of multipart data

NEEDS_BINMODE -> bool

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

PATH_SEPARATOR -> Hash

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

継承したメソッド

! != [] 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 == === =~ __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 must_be must_be_close_to must_be_empty must_be_instance_of must_be_kind_of must_be_nil must_be_same_as must_be_within_epsilon must_equal must_include must_match must_raise must_respond_to must_send must_throw 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? respond_to_missing? singleton_class 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 trust untaint untrust untrusted? wont_be wont_be_close_to wont_be_empty wont_be_instance_of wont_be_kind_of wont_be_nil wont_be_same_as wont_be_within_epsilon wont_equal wont_include wont_match wont_respond_to .new

追加されるメソッド

定義 説明 ライブラリ
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, *element) -> String
unescape_element(string, *element) -> String

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

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

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

cgi/util