method

for

ruby latest stable - Class: Bundler::SpecSet

Method not available on this version

This method is only available on newer versions. The first available version (v2_6_3) is shown here.

for(dependencies, skip = [], check = false, match_current_platform = false, raise_on_missing = true)
public

No documentation available.

# File lib/bundler/spec_set.rb, line 19
    def for(dependencies, skip = [], check = false, match_current_platform = false, raise_on_missing = true)
      handled = Set.new
      deps = dependencies.dup
      specs = []
      skip += ["bundler"]

      loop do
        break unless dep = deps.shift
        next if !handled.add?(dep) || skip.include?(dep.name)

        if spec = spec_for_dependency(dep, match_current_platform)
          specs << spec

          spec.dependencies.each do |d|
            next if d.type == :development
            d = DepProxy.new(d, dep.__platform) unless match_current_platform
            deps << d
          end
        elsif check
          return false
        elsif raise_on_missing
          others = lookup[dep.name] if match_current_platform
          message = "Unable to find a spec satisfying #{dep} in the set. Perhaps the lockfile is corrupted?"
          message += " Found #{others.join(", ")} that did not match the current platform." if others && !others.empty?
          raise GemNotFound, message
        end
      end

      if spec = lookup["bundler"].first
        specs << spec
      end

      check ? true : SpecSet.new(specs)
    end