required_location (Gem)

    # File lib/rubygems.rb, line 836
      def self.required_location(gemname, libfile, *requirements)
        requirements = Gem::Requirement.default if requirements.empty?

        matches = Gem.source_index.find_name gemname, requirements

        return nil if matches.empty?

        spec = matches.last
        spec.require_paths.each do |path|
          result = File.join spec.full_gem_path, path, libfile
          return result if File.exist? result
        end

        nil
      end