class FactoryBot::Trait
@api private
Attributes
Public Class Methods
Source
# File lib/factory_bot/trait.rb, line 9 def initialize(name, **options, &block) @name = name.to_s @block = block @uri_manager = FactoryBot::UriManager.new(names, paths: options[:uri_paths]) @definition = Definition.new(@name, uri_manager: @uri_manager) proxy = FactoryBot::DefinitionProxy.new(@definition) if block proxy.instance_eval(&@block) end end
Public Instance Methods
Source
# File lib/factory_bot/trait.rb, line 30 def ==(other) name == other.name && block == other.block end
Source
# File lib/factory_bot/trait.rb, line 22 def clone Trait.new(name, uri_paths: definition.uri_manager.paths, &block) end