Ruby 2.2.0 リファレンスマニュアル > ライブラリ一覧 > webrick/httputilsライブラリ > WEBrick::HTTPUtils::FormDataクラス

class WEBrick::HTTPUtils::FormData

クラス・モジュールの継承リスト: WEBrick::HTTPUtils::FormData < String < Comparable < Object < Kernel < BasicObject

要約

クライアントがフォームへ入力した値を表すクラスです。multipart/form-data なデータを表すのにも使われます。

WEBrick::HTTPRequest#query はリクエストのクエリーあるいはクライアントがフォームへ入力した値を保持した Hash を返しますが、その Hash のキーと値のうち値は FormData クラスのインスタンスになります。同じ名前のフィールドが複数ある場合、WEBrick::HTTPUtils::FormData#listWEBrick::HTTPUtils::FormData#each_data によりそれぞれの値を取り出すことができます。

通常のフォームデータ(application/x-www-form-urlencoded)は unescape されています。ただし multipart/form-data なフォームデータはユーザが content-transfer-encoding ヘッダを見て適切に処理する必要があります。

リンク

特異メソッド

定義 説明
new(*args) -> WEBrick::HTTPUtils::FormData

WEBrick::HTTPUtils の内部で使われます。ユーザがこのメソッドを直接呼ぶことはありません。

インスタンスメソッド

定義 説明
self << str -> self

WEBrick::HTTPUtils の内部で使われます。ユーザがこのメソッドを直接呼ぶことはありません。

self[header] -> String | nil

自身が multipart/form-data なデータの場合に、header で指定されたヘッダの値を文字列で返します。無ければ nil を返します。

append_data(data) -> self

WEBrick::HTTPUtils の内部で使われます。ユーザがこのメソッドを直接呼ぶことはありません。

each_data {|s| ... }

自身が表す各フォームデータを引数として、与えられたブロックを実行します。

filename -> String | nil
filename=(value)

フォームデータの filename 属性を文字列で表すアクセサです。

list -> Array
to_ary -> Array

自身が表す各フォームデータを収納した配列を生成して返します。

name -> String | nil
name=(value)

フォームデータの name 属性を文字列で表すアクセサです。

to_s -> String

自身が表すフォームデータのうちのひとつを文字列として返します。

継承したメソッド

! != __id__ __send__ instance_eval instance_exec method_missing singleton_method_added singleton_method_removed singleton_method_undefined < <= == > >= between? !~ _dump class clone define_singleton_method display enum_for equal? extend freeze frozen? initialize initialize_copy 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_hash to_int to_io to_proc to_regexp trust untaint untrust untrusted? .yaml_tag ::ARGF ::ARGV ::DATA ::ENV ::FALSE ::NIL ::RUBY_COPYRIGHT ::RUBY_DESCRIPTION ::RUBY_ENGINE ::RUBY_PATCHLEVEL ::RUBY_PLATFORM ::RUBY_RELEASE_DATE ::RUBY_REVISION ::RUBY_VERSION ::SCRIPT_LINES__ ::STDERR ::STDIN ::STDOUT ::TOPLEVEL_BINDING ::TRUE % * + << <=> == =~ [] []= ascii_only? b bytes bytesize byteslice capitalize capitalize! casecmp center chars chomp chomp! chop chop! chr clear codepoints count crypt delete delete! downcase downcase! dump each_byte each_char each_codepoint each_line empty? encode encode! encoding end_with? eql? ext force_encoding getbyte gsub gsub! hash hex include? index insert inspect intern iseuc isjis issjis isutf8 kconv length lines ljust lstrip lstrip! match next next! oct ord parse_csv partition pathmap pathmap_explode pathmap_partial pathmap_replace prepend replace reverse reverse! rindex rjust rpartition rstrip rstrip! scan scanf scrub scrub! setbyte shellescape shellsplit slice! split squeeze squeeze! start_with? strip strip! sub sub! sum swapcase swapcase! to_c to_d to_f to_i to_r to_s toeuc tojis tolocale tosjis toutf16 toutf32 toutf8 tr tr! tr_s tr_s! unicode_normalize unicode_normalize! unicode_normalized? unpack upcase upcase! upto valid_encoding? .try_convert