class Gem::Resolver::DependencyRequest

内部使用。包装一个 Dependency 对象,以跟踪哪个规范包含了该 Dependency。

属性

dependency[R]

包装的 Gem::Dependency

requester[R]

此依赖项的请求者。

公共类方法

new(dependency, requester) 点击以切换源代码

为来自 requesterdependency 创建一个新的 DependencyRequest。如果请求来自用户,则 requester 可以为 nil。

# File rubygems/resolver/dependency_request.rb, line 22
def initialize(dependency, requester)
  @dependency = dependency
  @requester  = requester
end

公共实例方法

development?() 点击以切换源代码

此依赖项是否为开发依赖项?

# File rubygems/resolver/dependency_request.rb, line 41
def development?
  @dependency.type == :development
end
explicit?() 点击以切换源代码

表明该请求是用户显式请求的 gem

# File rubygems/resolver/dependency_request.rb, line 78
def explicit?
  @requester.nil?
end
implicit?() 点击以切换源代码

表明该请求是作为另一个 gem 的依赖项而请求的 gem

# File rubygems/resolver/dependency_request.rb, line 86
def implicit?
  !explicit?
end
match?(spec, allow_prerelease = false) 点击以切换源代码

此依赖项请求是否与 spec 匹配?

注意:match? 仅当 dependency 是预发布依赖项时才匹配预发布版本。

# File rubygems/resolver/dependency_request.rb, line 51
def match?(spec, allow_prerelease = false)
  @dependency.match? spec, nil, allow_prerelease
end
matches_spec?(spec) 点击以切换源代码

此依赖项请求是否与 spec 匹配?

注意:matches_spec? 匹配预发布版本。另请参阅 match?

# File rubygems/resolver/dependency_request.rb, line 60
def matches_spec?(spec)
  @dependency.matches_spec? spec
end
name() 点击以切换源代码

此依赖项请求正在请求的 gem 的名称。

# File rubygems/resolver/dependency_request.rb, line 67
def name
  @dependency.name
end
request_context() 点击以切换源代码

返回一个字符串,指示是谁导致添加此请求(仅对隐式请求有效)

# File rubygems/resolver/dependency_request.rb, line 94
def request_context
  @requester ? @requester.request : "(unknown)"
end
requirement() 点击以切换源代码

此依赖项请求的版本要求

# File rubygems/resolver/dependency_request.rb, line 112
def requirement
  @dependency.requirement
end
type() 点击以切换源代码
# File rubygems/resolver/dependency_request.rb, line 71
def type
  @dependency.type
end