Class: FactoryTrace::Preprocessors::ExtractUsed

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_trace/preprocessors/extract_used.rb

Class Method Summary collapse

Class Method Details

.call(trace) ⇒ FactoryTrace::Structures::Collection

Returns a collection with used factories and traits gathered from trace

Parameters:

  • (Hash<String, Set<String>>)

Returns:



9
10
11
12
13
14
15
16
17
# File 'lib/factory_trace/preprocessors/extract_used.rb', line 9

def self.call(trace)
  collection = FactoryTrace::Structures::Collection.new

  trace.each do |factory_name, trait_names|
    collection.add(FactoryTrace::Structures::Factory.new(factory_name, nil, trait_names.to_a))
  end

  collection
end