lib/lapidarius/cutter.rb in lapidarius-4.3.0 vs lib/lapidarius/cutter.rb in lapidarius-4.4.2
- old
+ new
@@ -12,25 +12,28 @@
@name = name
@cmd = cmd_klass.new
@version = version
@remote = remote
@dev_deps = []
+ @cache = {}
end
def call
recurse.tap do |gem|
gem.dev_count = dev_count if gem
end
end
- private def recurse(name: @name, gem: nil, version: @version, remote: @remote)
- tokens = tokenize(name, version, remote)
+ private def recurse(name: @name, gem: nil, version: @version)
+ tokens = tokenize(name, version, @remote)
token = tokens.shift
gem ||= Gem.factory(token)
tokens.each do |t|
next unless dep = Gem.factory(t)
- gem << dep
- recurse(name: dep.name, gem: dep, version: nil, remote: remote)
+ gem << @cache.fetch(t) do
+ recurse(name: dep.name, gem: dep, version: dep.version)
+ @cache[t] = dep
+ end
end
gem
end
def dev_count