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
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/factory_bot-6.5.0/lib/factory_bot/strategy_calculator.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/factory_bot-6.5.0/lib/factory_bot/strategy_calculator.rb
factory_bot-6.5.0 lib/factory_bot/strategy_calculator.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/factory_bot-6.4.6/lib/factory_bot/strategy_calculator.rb
factory_bot-6.4.6 lib/factory_bot/strategy_calculator.rb
factory_bot-6.4.5 lib/factory_bot/strategy_calculator.rb
factory_bot-6.4.4 lib/factory_bot/strategy_calculator.rb
factory_bot-6.4.3 lib/factory_bot/strategy_calculator.rb
factory_bot-6.4.2 lib/factory_bot/strategy_calculator.rb
factory_bot-6.4.1 lib/factory_bot/strategy_calculator.rb
factory_bot-6.4.0 lib/factory_bot/strategy_calculator.rb
factory_bot-6.3.0 lib/factory_bot/strategy_calculator.rb
factory_bot-6.2.1 lib/factory_bot/strategy_calculator.rb
factory_bot-6.2.0 lib/factory_bot/strategy_calculator.rb
factory_bot-6.1.0 lib/factory_bot/strategy_calculator.rb
factory_bot-6.0.2 lib/factory_bot/strategy_calculator.rb
factory_bot-6.0.1 lib/factory_bot/strategy_calculator.rb
factory_bot-6.0.0 lib/factory_bot/strategy_calculator.rb
factory_bot-5.2.0 lib/factory_bot/strategy_calculator.rb
factory_bot-5.1.2 lib/factory_bot/strategy_calculator.rb