Sha256: 736f830c416a766664dd136652cd9aa6fdd5ebeb03280d2a603c78880fae074c

Contents?: true

Size: 473 Bytes

Versions: 22

Compression:

Stored size: 473 Bytes

Contents

module FactoryBot
  # @api private
  class StrategyCalculator
    def initialize(name_or_object)
      @name_or_object = name_or_object
    end

    def strategy
      if strategy_is_object?
        @name_or_object
      else
        strategy_name_to_object
      end
    end

    private

    def strategy_is_object?
      @name_or_object.is_a?(Class)
    end

    def strategy_name_to_object
      FactoryBot::Internal.strategy_by_name(@name_or_object)
    end
  end
end

Version data entries

22 entries across 21 versions & 3 rubygems

Version Path
factory_bot-5.1.1 lib/factory_bot/strategy_calculator.rb
factory_bot-5.1.0 lib/factory_bot/strategy_calculator.rb