class FactoryBot::DeclarationList

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/factory_bot/declaration_list.rbs

class FactoryBot::DeclarationList
  def attributes: () -> FactoryBot::AttributeList
  def declare_attribute: (FactoryBot::Declaration::Dynamic declaration) -> FactoryBot::Declaration::Dynamic
  def initialize: (?Symbol name) -> void
end

@api private

def attributes

Experimental RBS support (using type sampling data from the type_fusion project).

def attributes: () -> FactoryBot::AttributeList

This signature was generated using 4 samples from 1 application.

def attributes
  @attributes ||= AttributeList.new(@name).tap do |list|
    to_attributes.each do |attribute|
      list.define_attribute(attribute)
    end
  end
end

def declare_attribute(declaration)

Experimental RBS support (using type sampling data from the type_fusion project).

def declare_attribute: (FactoryBot::Declaration::Dynamic declaration) -> FactoryBot::Declaration::Dynamic

This signature was generated using 2 samples from 1 application.

def declare_attribute(declaration)
  delete_declaration(declaration) if overridable?
  @declarations << declaration
  declaration
end

def delete_declaration(declaration)

def delete_declaration(declaration)
  @declarations.delete_if { |decl| decl.name == declaration.name }
end

def each(&block)

def each(&block)
  @declarations.each(&block)
end

def initialize(name = nil)

Experimental RBS support (using type sampling data from the type_fusion project).

def initialize: (?Symbol name) -> void

This signature was generated using 3 samples from 1 application.

def initialize(name = nil)
  @declarations = []
  @name = name
  @overridable = false
end

def overridable

def overridable
  @overridable = true
end

def overridable?

def overridable?
  @overridable
end

def to_attributes

def to_attributes
  @declarations.reduce([]) { |result, declaration| result + declaration.to_attributes }
end