class FactoryBot::Declaration::Implicit
@api private
Attributes
factory[R]
Public Class Methods
new(name, factory = nil, ignored = false)
click to toggle source
Calls superclass method
FactoryBot::Declaration::new
# File lib/factory_bot/declaration/implicit.rb, line 5 def initialize(name, factory = nil, ignored = false) super(name, ignored) @factory = factory end
Public Instance Methods
==(other)
click to toggle source
# File lib/factory_bot/declaration/implicit.rb, line 10 def ==(other) self.class == other.class && name == other.name && factory == other.factory && ignored == other.ignored end
Private Instance Methods
build()
click to toggle source
# File lib/factory_bot/declaration/implicit.rb, line 23 def build if FactoryBot.factories.registered?(name) [Attribute::Association.new(name, name, {})] elsif FactoryBot::Internal.sequences.registered?(name) [Attribute::Sequence.new(name, name, @ignored)] elsif @factory.name.to_s == name.to_s message = "Self-referencing trait '#{@name}'" raise TraitDefinitionError, message else @factory.inherit_traits([name]) [] end end