In Files

  • ruby-3.1.2/lib/rubygems/source/local.rb

Parent

Methods

Files

Class/Module Index [+]

Quicksearch

Gem::Source::Local

The local source finds gems in the current directory for fulfilling dependencies.

Public Instance Methods

<=>(other) click to toggle source

Local sorts before Gem::Source and after Gem::Source::Installed

 
               # File ruby-3.1.2/lib/rubygems/source/local.rb, line 17
def <=>(other)
  case other
  when Gem::Source::Installed,
       Gem::Source::Lock then
    -1
  when Gem::Source::Local then
    0
  when Gem::Source then
    1
  else
    nil
  end
end
            
find_gem(gem_name, version = Gem::Requirement.default, prerelease = false) click to toggle source
 
               # File ruby-3.1.2/lib/rubygems/source/local.rb, line 80
def find_gem(gem_name, version = Gem::Requirement.default, # :nodoc:
             prerelease = false)
  load_specs :complete

  found = []

  @specs.each do |n, data|
    if n.name == gem_name
      s = data[1].spec

      if version.satisfied_by?(s.version)
        if prerelease
          found << s
        elsif !s.version.prerelease? || version.prerelease?
          found << s
        end
      end
    end
  end

  found.max_by {|s| s.version }
end