class Gem::MissingSpecVersionError
当尝试激活一个 gem 时,如果该 gem 存在于系统上,但不存在请求的版本,则会引发此错误。 请确保从父类 Gem::LoadError
中捕获异常,而不是从这个类中捕获,以捕获所有类型的加载错误。
属性
公共类方法
源代码
# File lib/rubygems/errors.rb, line 56 def initialize(name, requirement, specs) @specs = specs super(name, requirement) end
调用父类方法
Gem::MissingSpecError::new
私有实例方法
源代码
# File lib/rubygems/errors.rb, line 63 def build_message names = specs.map(&:full_name) "Could not find '#{name}' (#{requirement}) - did find: [#{names.join ","}]\n" end