Class: FactoryBotFactory::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_bot_factory/config.rb

Constant Summary collapse

DEFAULT_CONVERTERS =
{
  hash_converter:        Converters::HashConverter,
  string_converter:      Converters::StringConverter,
  numeric_converter:     Converters::NumericConverter,
  big_decimal_converter: Converters::NumericConverter,
  open_struct_converter: Converters::HashConverter,
  nil_converter:         Converters::NilConverter,
  date_time_converter:   Converters::DateTimeConverter,
  date_converter:        Converters::StringConverter,
  array_converter:       Converters::HashConverter
}
DEFAULT_OPTIONS =
{
  factory_path: nil,
  print_output: false
}.merge(DEFAULT_CONVERTERS)

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.



22
23
24
25
# File 'lib/factory_bot_factory/config.rb', line 22

def initialize(options = {})
  options = DEFAULT_OPTIONS.merge(options)
  options.each { |k, v| instance_variable_set(:"@#{k}", v) }
end

Instance Method Details

#factory_path=(path) ⇒ Object



27
28
29
30
# File 'lib/factory_bot_factory/config.rb', line 27

def factory_path=(path)
  path = path[0..-2] if path&.end_with?("/")
  @factory_path = path
end