Class: Smith::Tool::ExecutionBatchInvocations

Inherits:
Object
  • Object
show all
Defined in:
lib/smith/tool/execution_batch_invocations.rb

Instance Method Summary collapse

Instance Method Details

#call(sources:, sequence:) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/smith/tool/execution_batch_invocations.rb', line 6

def call(sources:, sequence:)
  return {}.compare_by_identity.freeze if sources.empty?

  first_ordinal = sequence.reserve(sources.length)
  sources.each_with_index.with_object({}.compare_by_identity) do |(source, index), invocations|
    invocations[source.tool_call] = build_invocation(source, index, first_ordinal, sources.length)
  end.freeze
end