Method: Fast.group_results

Defined in:
lib/fast.rb

.group_results(group_files, locations, parallel: true) ⇒ Hash[String, Array]

Compact grouped results by file allowing parallel processing. parallel or not. while it process several locations in parallel.

Parameters:

  • group_files (Proc)

    allows to define a search that can be executed

  • on_result (Proc)

    allows to define a callback for fast feedback

  • parallel (Boolean) (defaults to: true)

    runs the ‘group_files` in parallel

Returns:

  • (Hash[String, Array])

    with files and results



231
232
233
234
235
236
237
238
239
# File 'lib/fast.rb', line 231

def group_results(group_files, locations, parallel: true)
  files = ruby_files_from(*locations)
  if parallel
    require 'parallel' unless defined?(Parallel)
    Parallel.map(files, &group_files)
  else
    files.map(&group_files)
  end.compact.inject(&:merge!)
end