class Gem::Specification
def full_gem_path
def full_gem_path # this cannot check source.is_a?(Bundler::Plugin::API::Source) # because that _could_ trip the autoload, and if there are unresolved # gems at that time, this method could be called inside another require, # thus raising with that constant being undefined. Better to check a method if source.respond_to?(:path) || (source.respond_to?(:bundler_plugin_api_source?) && source.bundler_plugin_api_source?) Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" } else rg_full_gem_path end end