class Gem::Resolver::ActivationRequest

指定一个应该被激活的 Specification 对象。同时也包含一个用于引入此激活的依赖项。

属性

request[R]

此激活请求的父请求。

spec[R]

要激活的规范。

公共类方法

new(spec, request) 点击切换源码

创建一个新的 ActivationRequest,它将激活 spec。 父级 request 用于在发生冲突时提供诊断信息。

# File rubygems/resolver/activation_request.rb, line 22
def initialize(spec, request)
  @spec = spec
  @request = request
end

公共实例方法

development?() 点击切换源码

此激活请求是否用于开发依赖项?

# File rubygems/resolver/activation_request.rb, line 49
def development?
  @request.development?
end
download(path) 点击切换源码

path 下载一个 gem 并返回文件路径。

# File rubygems/resolver/activation_request.rb, line 56
def download(path)
  Gem.ensure_gem_subdirectories path

  if @spec.respond_to? :sources
    exception = nil
    path = @spec.sources.find do |source|
      source.download full_spec, path
    rescue exception
    end
    return path      if path
    raise  exception if exception

  elsif @spec.respond_to? :source
    source = @spec.source
    source.download full_spec, path

  else
    source = Gem.sources.first
    source.download full_spec, path
  end
end
eql?(other) 点击切换源码
# File rubygems/resolver/activation_request.rb, line 38
def eql?(other)
  self == other
end
full_name() 点击切换源码

要激活的规范的完整名称。

# File rubygems/resolver/activation_request.rb, line 81
def full_name
  name_tuple.full_name
end
别名为: to_s
full_spec() 点击切换源码

此激活请求的 Gem::Specification

# File rubygems/resolver/activation_request.rb, line 90
def full_spec
  Gem::Specification === @spec ? @spec : @spec.spec
end
hash() 点击切换源码
# File rubygems/resolver/activation_request.rb, line 42
def hash
  @spec.hash
end
installed?() 点击切换源码

如果请求的 gem 已经安装,则为 True。

# File rubygems/resolver/activation_request.rb, line 101
def installed?
  case @spec
  when Gem::Resolver::VendorSpecification then
    true
  else
    this_spec = full_spec

    Gem::Specification.any? do |s|
      s == this_spec && s.base_dir == this_spec.base_dir
    end
  end
end
name() 点击切换源码

此激活请求规范的名称

# File rubygems/resolver/activation_request.rb, line 117
def name
  @spec.name
end
parent() 点击切换源码

返回包含我们被激活的依赖项的 ActivationRequest

# File rubygems/resolver/activation_request.rb, line 125
def parent
  @request.requester
end
platform() 点击切换源码

此激活请求规范的平台

# File rubygems/resolver/activation_request.rb, line 150
def platform
  @spec.platform
end
to_s()
别名为: full_name
version() 点击切换源码

此激活请求规范的版本

# File rubygems/resolver/activation_request.rb, line 143
def version
  @spec.version
end

私有实例方法

name_tuple() 点击切换源码
# File rubygems/resolver/activation_request.rb, line 156
def name_tuple
  @name_tuple ||= Gem::NameTuple.new(name, version, platform)
end