我在一个适用于其他所有人的 repo 中检查了一个新的提交。我运行一个 rake 任务,它调用此代码并引发undefined
错误,即使Gem.source_index
似乎已定义。
module Gem
puts "in module Gem"
def self.source_index=(index)
puts "defining the source index"
@@source_index = index
end
end
module Rails
class GemDependency < Gem::Dependency
attr_accessor :lib, :source, :dep
def self.add_frozen_gem_path
puts "Oh hi there"
puts "the source index is " + Gem.source_index // ERROR HERE
end
输出是
in module Gem
Oh hi there
rake aborted!
undefined method `source_index' for Gem:Module
怎么了?