Class: Satisfactory::Loader Private

Inherits:
Object
  • Object
show all
Defined in:
lib/satisfactory/loader.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Loads factory configurations from FactoryBot.

Since:

  • 0.2.0

Class Method Summary collapse

Class Method Details

.factory_configurations{Symbol => Hash}

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Skips factories that don’t have a model that inherits from ApplicationRecord.

Returns:

  • ({Symbol => Hash})

    a hash of factory configurations by factory name

Since:

  • 0.2.0



12
13
14
15
16
17
18
19
# File 'lib/satisfactory/loader.rb', line 12

def factory_configurations
  FactoryBot.factories.each.with_object({}) do |factory, configurations|
    next unless (model = factory.build_class)
    next unless model < ApplicationRecord

    configurations[factory.name] = configuration_for(factory, model)
  end
end