Method: LibGems::DependencyList#spec_predecessors

Defined in:
lib/libgems/dependency_list.rb

#spec_predecessorsObject

Return a hash of predecessors. result[spec] is an Array of gemspecs that have a dependency satisfied by the named gemspec.



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/libgems/dependency_list.rb', line 154

def spec_predecessors
  result = Hash.new { |h,k| h[k] = [] }

  specs = @specs.sort.reverse

  specs.each do |spec|
    specs.each do |other|
      next if spec == other

      other.dependencies.each do |dep|
        if spec.satisfies_requirement? dep then
          result[spec] << other
        end
      end
    end
  end

  result
end