module

FactoryBot

Constants

VERSION = "6.5.6"

Class methods

__constantize(name : String) : ActiveRecord::Base.class

Runtime-разрешение имени класса по справочнику моделей (замена Ruby constantize; заполняется на macro finished, когда все модели уже зарегистрированы через macro inherited).

__normalize(value) : FBValue
__normalize_int(value : FBValue) : FBValue

Int32 → Int64, Symbol остаётся Symbol (на запись в колонку приводится к String в AttributeAssigner).

__opt_class?(v : OptValue | Nil) : String | Symbol | ActiveRecord::Base.class | Nil
__opt_string?(v : OptValue | Nil) : String | Nil
__opts_hash(nt : NamedTuple) : Hash(String, OptValue)

NamedTuple опций/оврайдов → Hash(String, Object) (без нормализации; значения любого типа).

__overrides_hash(nt : NamedTuple) : Hash(String, FBValue)

NamedTuple оврайдов → Hash(String, FBValue).

__strategy_run(strategy : String, name : String | Symbol, traits : Array(String), overrides : Hash(String, FBValue)) : Product | Nil
__strategy_run(strategy : String, name : String | Symbol, traits : Array(String), overrides : Hash(String, FBValue), &block : Proc(Product, Nil)) : Product | Nil
__string_list?(v : OptValue | Nil) : Array(String) | Nil
__traits_a(traits) : Array(String)

Tuple-сплат трейтов → Array(String) (аннотированный сплат вместе с **overrides ломает матчинг нулевого числа аргументов — см. PLAN.md).

after(*names : String | Symbol, &block : Proc(ActiveRecord::Base, Evaluator, Nil)) : Nil
aliases
aliases=(vals : Array(Tuple(Regex, String)))
aliases_for(attribute : String) : Array(String)
attributes_for(_name : String | Symbol, *_traits, **overrides) : Hash(String, FBValue)
attributes_for_list(_name : String | Symbol, _amount : Int32, *_traits, **overrides) : Array(Hash(String, FBValue))
attributes_for_pair(_name : String | Symbol, *_traits, **overrides) : Array(Hash(String, FBValue))
automatically_define_enum_traits=(automatically_define_enum_traits)
automatically_define_enum_traits?
before(*names : String | Symbol, &block : Proc(ActiveRecord::Base, Evaluator, Nil)) : Nil

Глобальные before/after/to_create/initialize_with вне блока define.

build(_name : String | Symbol, *_traits, **overrides, &block : Proc(Product, Nil)) : Product | Nil
build(_name : String | Symbol, *_traits, **overrides) : Product | Nil
build_list(_name : String | Symbol, _amount : Int32, *_traits, **overrides, &block : Proc(Product, Int32, Nil)) : Array(Product)
build_list(_name : String | Symbol, _amount : Int32, *_traits, **overrides) : Array(Product)
build_pair(_name : String | Symbol, *_traits, **overrides) : Array(Product)
build_stubbed(_name : String | Symbol, *_traits, **overrides, &block : Proc(Product, Nil)) : Product | Nil
build_stubbed(_name : String | Symbol, *_traits, **overrides) : Product | Nil
build_stubbed_list(_name : String | Symbol, _amount : Int32, *_traits, **overrides) : Array(Product)
build_stubbed_pair(_name : String | Symbol, *_traits, **overrides) : Array(Product)
create(_name : String | Symbol, *_traits, **overrides, &block : Proc(Product, Nil)) : Product | Nil
create(_name : String | Symbol, *_traits, **overrides) : Product | Nil
create_list(_name : String | Symbol, _amount : Int32, *_traits, **overrides, &block : Proc(Product, Int32, Nil)) : Array(Product)
create_list(_name : String | Symbol, _amount : Int32, *_traits, **overrides) : Array(Product)
create_pair(_name : String | Symbol, *_traits, **overrides) : Array(Product)
define
factories
generate(_name : String | Symbol) : FBValue
generate_list(_name : String | Symbol, count : Int32) : Array(FBValue)
initialize_with
lint(factories : Array(Factory) | Nil = nil, traits : Bool = false, verbose : Bool = false, strategy : String | Symbol = "create") : Nil
modify
null(_name : String | Symbol, *_traits, **overrides) : Product | Nil
register_factory(factory : Factory)
register_sequence(sequence : Sequence)
register_strategy(name : String | Symbol, strategy : Strategy::Base)
register_trait(trait : Trait)
reload
rewind_sequences
run_strategy(strategy_name : String | Symbol, _name : String | Symbol, *_traits, **overrides) : Product | Nil

Запуск произвольной (в т.ч. кастомной) стратегии по имени — замена runtime-генерации методов в StrategySyntaxMethodRegistrar.

sequence_setting_timeout
sequence_setting_timeout=(sequence_setting_timeout)
sequences
skip_create
to_create
use_parent_strategy=(use_parent_strategy)
use_parent_strategy?

Nested types