Ruby 4.0 リファレンスマニュアル

instance method Gem::Dependency#matches_spec?

matches_spec?(spec) -> boolRuby 1.9.3 から[permalink][rdoc][edit]

self が spec にマッチするかどうかを返します。

Gem::Dependency#name が spec の名前と一致せず、または spec のバージョンが self の条件を満たさない場合は false を返します。Gem::Dependency#match? と異なり、self がプレリリース版を要求していなくても、spec 自体がプレリリース版であれば true を返すことがあります。

[PARAM] spec:
マッチさせたい Gem::Specification のインスタンスを指定します。
例
dep = Gem::Dependency.new("rake", "~> 1.0")

spec1 = Gem::Specification.new("rake", "1.0.1")
p dep.matches_spec?(spec1) # => true

spec2 = Gem::Specification.new("rake", "2.0.0")
p dep.matches_spec?(spec2) # => false

[SEE_ALSO] Gem::Dependency#match?