クラス
-
URI
:: FTP (72) -
URI
:: Generic (648) -
URI
:: HTTP (48) -
URI
:: LDAP (156) -
URI
:: LDAPS (12) -
URI
:: MailTo (108)
キーワード
- + (12)
- - (12)
- == (12)
- BadURIError (12)
- COMPONENT (12)
-
DEFAULT
_ PORT (24) - Error (12)
- FTP (12)
- Generic (12)
- HTTP (12)
- HTTPS (12)
- InvalidComponentError (12)
- InvalidURIError (12)
- LDAP (12)
- LDAPS (12)
- MailTo (12)
- UNSAFE (12)
- URI (24)
- absolute (12)
- absolute? (12)
- attributes (12)
- attributes= (12)
- build (120)
- build2 (24)
- coerce (12)
- component (24)
- decode (7)
-
decode
_ www _ form (12) -
decode
_ www _ form _ component (12) -
default
_ port (24) - dn (12)
- dn= (12)
- encode (7)
-
encode
_ www _ form (12) -
encode
_ www _ form _ component (12) - escape (7)
- extensions (12)
- extensions= (12)
- extract (48)
- filter (12)
- filter= (12)
-
find
_ proxy (12) - fragment (12)
- fragment= (12)
- headers (12)
- headers= (12)
- hierarchical? (12)
- host (12)
- host= (12)
- hostname (12)
- hostname= (12)
- join (12)
- merge (12)
- merge! (12)
- new (60)
- new2 (12)
- normalize (12)
- normalize! (12)
- opaque (12)
- opaque= (12)
- parse (12)
- parser (12)
- password (12)
- password= (12)
- path (12)
- path= (12)
- port (12)
- port= (12)
- query (12)
- query= (12)
- regexp (24)
- registry (12)
- registry= (12)
- relative? (12)
-
request
_ uri (12) -
route
_ from (12) -
route
_ to (12) - scheme (12)
- scheme= (12)
- scope (12)
- scope= (12)
- select (12)
- split (12)
- to (12)
- to= (12)
-
to
_ mailtext (12) -
to
_ rfc822text (12) -
to
_ s (12) - typecode (12)
- typecode= (12)
- unescape (7)
-
use
_ registry (12) - user (12)
- user= (12)
- userinfo (12)
- userinfo= (12)
検索結果
先頭5件
-
Kernel
. # URI(uri _ str) -> object (2.0) -
与えられた URI から該当する URI::Generic のサブクラスのインスタンスを生成して 返します。scheme が指定されていない場合は、URI::Generic オブジェクトを返します。
...た URI から該当する URI::Generic のサブクラスのインスタンスを生成して
返します。scheme が指定されていない場合は、URI::Generic オブジェクトを返します。
@param uri_str パースしたい URI を文字列として与えます。
@raise URI::Inval......idURIError パースに失敗した場合に発生します。
@see URI.parse... -
URI (2.0)
-
URI を扱うためのモジュールです。
...URI を扱うためのモジュールです。... -
URI
. decode(str) -> String (2.0) -
URI 文字列をデコードした文字列を返します。
...
URI 文字列をデコードした文字列を返します。
このメソッドは obsolete です。
代わりに
CGI.unescape,
URI.decode_www_form,
URI.decode_www_form_component
などの使用を検討してください。
例:
require 'uri'
puts URI.unescape('http://images.google.co.jp/......images?q=%A5%E2%A5%CA%A5%EA%A5%B6&ie=EUC-JP')
#=> "http://images.google.co.jp/images?q=モナリザ&ie=EUC-JP"
@param str URI を文字列として与えます。... -
URI
. decode _ www _ form(str , enc=Encoding :: UTF _ 8) -> [[String , String]] (2.0) -
文字列から URL-encoded form data をデコードします。
...されています。
そのため「&」区切りのみに対応していて、「;」区切りには対応していません。
require 'uri'
ary = URI.decode_www_form("a=1&a=2&b=3")
p ary #=> [['a', '1'], ['a', '2'], ['b', '3']]
p ary.assoc('a').last #=> '1'
p ary.assoc......('b').last #=> '3'
p Hash[ary] #=> {"a"=>"2", "b"=>"3"}
@param str デコード対象の文字列
@param enc エンコーディング
@raise ArgumentError str のフォーマットが不正である場合に発生します
@see URI.decode_www_form_component, URI.encode_www_form... -
URI
. decode _ www _ form _ component(str , enc=Encoding :: UTF _ 8) -> String (2.0) -
URL-encoded form data の文字列の各コンポーネント をデコードした文字列を返します。
...URL-encoded form data の文字列の各コンポーネント
をデコードした文字列を返します。
通常は URI.decode_www_form を使うほうがよいでしょう。
"+" という文字は空白文字にデコードします。
enc で指定したエンコーディングの文字......れています。
//emlist[][ruby]{
require 'uri'
enc = URI.encode_www_form_component('Ruby リファレンスマニュアル')
# => "Ruby+%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9%E3%83%9E%E3%83%8B%E3%83%A5%E3%82%A2%E3%83%AB"
p URI.decode_www_form_component(enc)
# => "Ruby リファ......レンスマニュアル"
//}
@param str デコード対象の文字列
@param enc エンコーディング
@raise ArgumentError str のフォーマットが不正である場合に発生します
@see URI.encode_www_form_component, URI.decode_www_form... -
URI
. encode(str , unsafe = URI :: UNSAFE) -> String (2.0) -
URI 文字列をエンコードした文字列を返します。
...
URI 文字列をエンコードした文字列を返します。
このメソッドは obsolete です。
代わりに
ERB::Util.#url_encode,
CGI.escape,
URI.encode_www_form_component,
WEBrick::HTTPUtils.#escape_form,
WEBrick::HTTPUtils.#escape
などの使用を検討してください。
詳細......ください。
例:
require 'uri'
p URI.escape('http://images.google.co.jp/images?q=モナリザ&ie=EUC-JP')
#=> "http://images.google.co.jp/images?q=%A5%E2%A5%CA%A5%EA%A5%B6&ie=EUC-JP"
@param str URI を文字列として与えます。
@param unsafe URI として指定できない文... -
URI
. encode _ www _ form(enum , enc=nil) -> String (2.0) -
enum から URL-encoded form data を生成します。
...uire 'uri'
URI.encode_www_form([["a", "1"], ["b", "2"], ["c", "x yz"]])
# => "a=1&b=2&c=x+yz"
実際には、each のブロック呼び出しで [key, value] の形のデータを渡すものであれば
何でも渡すことができます(例えば Hash など)。
require 'uri'
URI.encod......い場合は multipart/form-data をつかうべきで
このメソッドを使うべきではありません。
このメソッドは内部的に
URI.encode_www_form_component
を使っています。
このメソッドは
https://url.spec.whatwg.org/#concept-urlencoded-serializer
にもとづい......されています。
@param enum エンコードするデータ列([key, value] という形のデータの列)
@param enc 指定された場合、パーセントエンコーディングする前に、このエンコーディングに変換
@see URI.encode_www_form_component, URI.decode_www_form... -
URI
. encode _ www _ form _ component(str , enc=nil) -> String (2.0) -
文字列を URL-encoded form data の1コンポーネント としてエンコードした文字列を返します。
...文字列を URL-encoded form data の1コンポーネント
としてエンコードした文字列を返します。
通常は URI.encode_www_form を使うほうがよいでしょう。
このメソッドでは *, -, ., 0-9, A-Z, _, a-z, は変換せず、
空白は + に変換し、その他....../www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data
にもとづいて実装されています。
//emlist[][ruby]{
require 'uri'
p URI.encode_www_form_component('Ruby リファレンスマニュアル')
# => "Ruby+%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9%E3%83%9E%E......3%83%8B%E3%83%A5%E3%82%A2%E3%83%AB"
//}
@param str エンコードする文字列
@param enc 指定された場合、パーセントエンコーディングする前に、strをこのエンコーディングに変換
@see URI.decode_www_form_component, URI.encode_www_form... -
URI
. escape(str , unsafe = URI :: UNSAFE) -> String (2.0) -
URI 文字列をエンコードした文字列を返します。
...
URI 文字列をエンコードした文字列を返します。
このメソッドは obsolete です。
代わりに
ERB::Util.#url_encode,
CGI.escape,
URI.encode_www_form_component,
WEBrick::HTTPUtils.#escape_form,
WEBrick::HTTPUtils.#escape
などの使用を検討してください。
詳細......ください。
例:
require 'uri'
p URI.escape('http://images.google.co.jp/images?q=モナリザ&ie=EUC-JP')
#=> "http://images.google.co.jp/images?q=%A5%E2%A5%CA%A5%EA%A5%B6&ie=EUC-JP"
@param str URI を文字列として与えます。
@param unsafe URI として指定できない文... -
URI
. extract(str) -> [String] (2.0) -
文字列 str に対してパターンマッチングを試み、 絶対URIにマッチした部分文字列からなる配列として返します。 抽出する URI がなければ空の配列を返します。
...文字列 str に対してパターンマッチングを試み、
絶対URIにマッチした部分文字列からなる配列として返します。
抽出する URI がなければ空の配列を返します。
第2引数に文字列の配列 schemes が与えられた場合は
そのスキー......ムだけを検索します。
ブロックが与えられた場合は String#scan と同様で、
マッチした部分がみつかるたびに uri_str に
その部分を代入してブロックを評価します。
このときは nil を返します。
このメソッドは Ruby 2.2 から obs......対象としたいスキームを、文字列の配列として与えます。
例:
require 'uri'
str = "
http://www.ruby-lang.org/
http://www.ruby-lang.org/man-1.6/
"
p URI.extract(str, ["http"])
=> ["http://www.ruby-lang.org/", "http://www.ruby-lang.org/man-1.6/"]...