mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Simplify method chains by using #compact_map
This commit is contained in:
parent
3a508cae26
commit
0b06e72f7e
2 changed files with 4 additions and 10 deletions
|
@ -22,7 +22,7 @@ def new_report(successful_count = 5, failed_count = 5, error_count = 5, pending_
|
|||
error_count.times { results << new_failure_result(Spectator::ErroredResult) }
|
||||
pending_count.times { results << new_pending_result }
|
||||
|
||||
example_runtime = results.select(&.is_a?(Spectator::FinishedResult)).map(&.as(Spectator::FinishedResult)).sum(&.elapsed)
|
||||
example_runtime = results.compact_map(&.as?(Spectator::FinishedResult)).sum(&.elapsed)
|
||||
total_runtime = example_runtime + Time::Span.new(nanoseconds: overhead_time)
|
||||
Spectator::Report.new(results, total_runtime)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue