lib/leftovers/collector.rb in leftovers-0.2.3 vs lib/leftovers/collector.rb in leftovers-0.3.0
- old
+ new
@@ -29,13 +29,13 @@
@test_calls = @test_calls.to_set.freeze
end
def collect_file_list(list)
if Leftovers.parallel?
- Parallel.each(list, finish: method(:finish_parallel), &method(:collect_file))
+ Parallel.each(list, finish: method(:finish_file), &method(:collect_file))
else
- list.each { |file| finish_parallel(nil, nil, collect_file(file)) }
+ list.each { |file| finish_file(nil, nil, collect_file(file)) }
end
end
def collect_file(file)
file_collector = Leftovers::FileCollector.new(file.ruby, file)
@@ -44,14 +44,14 @@
file_collector.to_h
end
def print_progress
Leftovers.print(
- "checked #{@count} files, collected #{@count_calls} calls, #{@count_definitions} definitions\r" # rubocop:disable Layout/LineLength
+ "\e[2Kchecked #{@count} files, collected #{@count_calls} calls, #{@count_definitions} definitions\r" # rubocop:disable Layout/LineLength
)
end
- def finish_parallel(_, _, result) # rubocop:disable Metrics/MethodLength
+ def finish_file(_, _, result) # rubocop:disable Metrics/MethodLength
@count += 1
@count_calls += result[:calls].length
@count_definitions += result[:definitions].length
print_progress if Leftovers.progress?
if result[:test?]