class Gem::Source::SpecificFile
表示单个 .gem 文件的源。 这用于安装本地 gem。
属性
此特定文件的 gem 的路径。
从这个 .gem 文件中提取的 Gem::Specification
。
公共类方法
源
# File lib/rubygems/source/specific_file.rb, line 16 def initialize(file) @uri = nil @path = ::File.expand_path(file) @package = Gem::Package.new @path @spec = @package.spec @name = @spec.name_tuple end
为 file
中的 gem 创建一个新的 SpecificFile
公共实例方法
源
# File lib/rubygems/source/specific_file.rb, line 63 def <=>(other) case other when Gem::Source::SpecificFile then return nil if @spec.name != other.spec.name @spec.version <=> other.spec.version else super end end
将此源与 other
排序。
如果 other
是来自不同 gem 名称的 SpecificFile
,则返回 nil
。
如果 other
是来自相同 gem 名称的 SpecificFile
,则使用 Gem::Version#<=>
比较版本。
否则使用 Gem::Source#<=>
。
调用超类方法
Gem::Source#<=>