lib/bundler/dependencies/graph.rb in bundler-dependencies-0.5.1 vs lib/bundler/dependencies/graph.rb in bundler-dependencies-0.6.0
- old
+ new
@@ -7,11 +7,11 @@
@lockfile = lockfile
if lockfile
load_lockfile
else
- @specs = specs
+ @specs = specs.compact
end
end
def initialize_copy(source)
super
@@ -24,10 +24,14 @@
def each(&block)
gems.each(&block)
end
+ def find(gem)
+ include_dependency?(gem) ? Spec.find(gem) : nil
+ end
+
def counts(min: 0)
@counts ||= map do |gem|
count = gem.dependency_count
next if count < min
@@ -47,10 +51,10 @@
gems.include?(gem)
end
def include_dependency?(gem)
gem = Spec.new(gem) unless gem.is_a?(Spec)
- include?(gem) || any? { |spec| spec.dependencies.include_dependency?(gem) }
+ include?(gem) || any? { |spec| spec.include_dependency?(gem) }
end
def without(*gems)
graph = dup
graph.delete(*gems)