Ruby 2.3.0 リファレンスマニュアル > ライブラリ一覧 > rubygems/requirementライブラリ > Gem::Requirementクラス

class Gem::Requirement

クラス・モジュールの継承リスト: Gem::Requirement < Comparable < Object < Kernel < BasicObject
aliases: Gem::Version::Requirement

要約

Gem の必要条件を扱うクラスです。

このクラスのインスタンスには複数の必要条件を含めることができます。

:Gem::Dependency の内部で使われています。

特異メソッド

定義 説明
create(input) -> Gem::Requirement

Gem::Requirement のインスタンスを作成するためのファクトリメソッドです。

default -> Gem::Requirement

ゼロ以上 ( '>= 0' ) を指定して作成された Gem::Requirement のインスタンスを返します。

new(requirements) -> Gem::Requirement

Gem::Requirement のインスタンスを作成します。

parse(obj) -> Array

バージョンの必要上件をパースして比較演算子とバージョンを要素とする二要素の配列を返します。

インスタンスメソッド

定義 説明
satisfied_by?(version) -> bool
self === version -> bool
self =~ version -> bool

引数 version が自身に含まれる全ての必要条件を満たす場合に true を返します。そうでなければ、false を返します。

as_list -> [String]

必要条件を文字列の配列で返します。

concat(requirements) -> Array

新しい条件(配列)を自身の条件に破壊的に加えます。

exact? -> bool

条件がちょうどのバージョンが指定されている場合は、true を返します。

none? -> bool

自身が条件を持たない場合は、true を返します。

prerelease? -> bool

何らかのバージョンがプレリリースのものであれば、true を返します。

pretty_print(pp) -> String

わかりやすい形で、条件を表す文字列を返します。 pp メソッドで出力する際に、内部で用いられます。

specific? -> bool

条件に上限のある指定で、最新のバージョンにマッチしない可能性のある場合は、true を返します。

to_s -> String

条件を表す文字列を返します。

定数

定義 説明
OPS -> Hash

比較演算子と対応する処理を格納したハッシュです。次の内容と等価です。

継承したメソッド

! != __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 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_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