Sha256: 5fb7d0431d016a36b78fa07fb5d9fb287564c5cafe7f8aa6dc3cdff9fe4d8a33
Contents?: true
Size: 940 Bytes
Versions: 1
Compression:
Stored size: 940 Bytes
Contents
# frozen_string_literal: true module Bundler module Dependencies class Spec SPECS = {} # rubocop:disable Style/MutableConstant attr_accessor :name, :dependencies def self.new(name, dependencies = []) name = name.to_sym spec = find(name) || super(name) spec.dependencies = Graph.new(specs: dependencies.map { |d| new(d) }) if dependencies.any? spec end def self.find(name) SPECS[name.to_sym] end def initialize(name) @name = name @dependencies = Graph.new SPECS[name] = self end def include_dependency?(gem) dependencies.include_dependency?(gem) end def flatten dependencies.inject([]) do |arr, dependency| arr << dependency arr.concat(dependency.flatten) end.uniq end def dependency_count flatten.count end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bundler-dependencies-1.0.0 | lib/bundler/dependencies/spec.rb |