Class: FactoryBot::StrategySyntaxMethodRegistrar Private

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_bot/strategy_syntax_method_registrar.rb

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.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(strategy_name) ⇒ StrategySyntaxMethodRegistrar

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.

Returns a new instance of StrategySyntaxMethodRegistrar.



4
5
6
# File 'lib/factory_bot/strategy_syntax_method_registrar.rb', line 4

def initialize(strategy_name)
  @strategy_name = strategy_name
end

Class Method Details

.with_index(block, index) ⇒ Object

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.



14
15
16
17
18
19
20
# File 'lib/factory_bot/strategy_syntax_method_registrar.rb', line 14

def self.with_index(block, index)
  if block&.arity == 2
    ->(instance) { block.call(instance, index) }
  else
    block
  end
end

Instance Method Details

#define_strategy_methodsObject

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.



8
9
10
11
12
# File 'lib/factory_bot/strategy_syntax_method_registrar.rb', line 8

def define_strategy_methods
  define_singular_strategy_method
  define_list_strategy_method
  define_pair_strategy_method
end