Class: FactoryBot::Attribute Private

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_bot/attribute.rb,
lib/factory_bot/attribute/static.rb,
lib/factory_bot/attribute/dynamic.rb,
lib/factory_bot/attribute/sequence.rb,
lib/factory_bot/attribute/association.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Direct Known Subclasses

Association, Dynamic, Sequence, Static

Defined Under Namespace

Classes: Association, Dynamic, NonAttributeWriterValidator, Sequence, Static

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, ignored) ⇒ Attribute

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Attribute.

API:

  • private



11
12
13
14
15
# File 'lib/factory_bot/attribute.rb', line 11

def initialize(name, ignored)
  @name = name.to_sym
  @ignored = ignored
  ensure_non_attribute_writer!
end

Instance Attribute Details

#ignoredObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



9
10
11
# File 'lib/factory_bot/attribute.rb', line 9

def ignored
  @ignored
end

#nameObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



9
10
11
# File 'lib/factory_bot/attribute.rb', line 9

def name
  @name
end

Instance Method Details

#alias_for?(attr) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



25
26
27
# File 'lib/factory_bot/attribute.rb', line 25

def alias_for?(attr)
  FactoryBot.aliases_for(attr).include?(name)
end

#association?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



21
22
23
# File 'lib/factory_bot/attribute.rb', line 21

def association?
  false
end

#to_procObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



17
18
19
# File 'lib/factory_bot/attribute.rb', line 17

def to_proc
  -> { }
end