class FactoryBot::Trait

@api private

Attributes

block[R]
definition[R]
name[R]

Public Class Methods

new(name, &block) click to toggle source
# File lib/factory_bot/trait.rb, line 6
def initialize(name, &block)
  @name = name.to_s
  @block = block
  @definition = Definition.new(@name)
  proxy = FactoryBot::DefinitionProxy.new(@definition)

  if block
    proxy.instance_eval(&@block)
  end
end

Public Instance Methods

==(other) click to toggle source
# File lib/factory_bot/trait.rb, line 24
def ==(other)
  name == other.name &&
    block == other.block
end
names() click to toggle source
# File lib/factory_bot/trait.rb, line 20
def names
  [@name]
end