Ruby 2.3.0 リファレンスマニュアル > ライブラリ一覧 > uriライブラリ > URI::Genericクラス

class URI::Generic

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

要約

すべての URI クラスの基底クラスです。

hash と eql? が再定義されているため、Hash のキーとして利用することができます。

特異メソッド

定義 説明
build(ary) -> URI::Generic
build(hash) -> URI::Generic

引数で与えられた URI 構成要素から URI::Generic オブジェクトを生成します。

build2(ary) -> URI::Generic
build2(hash) -> URI::Generic

URI::Generic.build と同じですが、例外 URI::InvalidComponentError が発生した場合に、引数の各要素を URI.escape して再度 build を試みます。

component -> [Symbol]

URI の構成要素を表すシンボルの配列を返します。

default_port -> Integer | nil

スキームに対応するデフォルトのポート番号を整数で返します。

new(scheme, userinfo, host, port, registry, path, opaque, query, fragment, parser = URI::DEFAULT_PARSER, arg_check = false) -> URI::Generic

各引数を成分とする URI::Generic オブジェクトを生成して返します。

use_registry -> bool

構成要素 registry を受け付けるなら true を返します。 URI::Generic クラスでは false です。

インスタンスメソッド

定義 説明
merge(rel) -> URI::Generic
self + rel -> URI::Generic

自身と与えられたパス rel を連結した新しい URI オブジェクトを生成して返します。

route_from(src) -> URI::Generic
self - src -> URI::Generic

与えられた URI を表す src からの相対パスを返します。

self == uri -> bool

引数に指定した URI (文字列またはURIオブジェクト)との一致判定を行います。URI は正規化して比較されます。

absolute -> bool
absolute? -> bool

自身に scheme が設定されているなら true を返します。そうでない場合は false を返します。

coerce(oth) -> [URI, URI]

引数 oth をパースして [パース後の oth, self] の配列を返します。

component -> [Symbol]

self.class.component を返します。

default_port -> Integer | nil

self.class.default_port を返します。

find_proxy -> URI | nil

プロキシ URI を返します。

fragment -> String | nil

自身の fragment を文字列で返します。設定されていない場合は nil を返します。

fragment=(s)

自身の fragment を設定します。

hierarchical? -> bool

自身に path が設定されているなら true を返します。そうでない場合は false を返します。

host -> String | nil

自身の host を文字列で返します。設定されていない場合は nil を返します。

host=(s)

自身の host を設定します。

hostname -> String | nil

自身の hostname を文字列で返します。また、URI::Generic#host が設定されていない場合は nil を返します。

hostname=(s)

自身の hostname を設定します。

merge!(rel) -> self

与えられたパス rel を自身へ連結します。

normalize -> URI::Generic
normalize! -> String | nil

URI オブジェクトを正規化して返します。ホスト名を小文字にし、パスと構成要素がなければ '/' をセットします。

opaque -> String | nil

自身の opaque を文字列で返します。設定されていない場合は nil を返します。

opaque=(s)

自身の opaque を設定します。

parser -> URI::Parser

selfのパーサを返します。未定義であった場合は URI::DEFAULT_PARSER を返します。

password -> String | nil

自身の password を文字列で返します。設定されていない場合は nil を返します。

password=(s)

自身の password を設定します。

path -> String | nil

自身の path を文字列で返します。設定されていない場合は nil を返します。

path=(s)

自身の path を設定します。

port -> String | nil

自身の port を文字列で返します。設定されていない場合は nil を返します。

port=(s)

自身の port を設定します。

query -> String | nil

自身の query を文字列で返します。設定されていない場合は nil を返します。

query=(s)

自身の query を設定します。

registry -> String | nil

自身の registry を文字列で返します。設定されていない場合は nil を返します。

registry=(s)

自身の registry を設定します。

relative? -> bool

自身に scheme が設定されていないなら true を返します。そうでない場合は false を返します。

route_to(dst) -> URI::Generic

自身から dst への相対パスを返します。

scheme -> String | nil

自身の scheme を文字列で返します。設定されていない場合は nil を返します。

scheme=(s)

自身の scheme を設定します。

select(*components) -> [String]

指定された components に対応する構成要素を文字列の配列として返します。

to_s -> String

自身が表す URI を文字列として返します。

user -> String | nil

自身の userinfo を文字列で返します。

user=(s)

自身の user を設定します。

userinfo -> String | nil

自身の userinfo を "username:password" という形式の文字列で返します。設定されていない場合は nil を返します。

userinfo=(s)

自身の userinfo を設定します。

定数

定義 説明
COMPONENT -> [Symbol]

URI::Generic で利用可能なコンポーネントの一覧です。

DEFAULT_PORT -> nil

URI::Generic のデフォルトポート(nil)です。

継承したメソッド

! != __id__ __send__ instance_eval instance_exec method_missing singleton_method_added singleton_method_removed singleton_method_undefined !~ <=> === =~ _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_str trust untaint untrust untrusted? .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 ::UNSAFE