Class: FactoryBot::AttributeList Private
- Inherits:
-
Object
- Object
- FactoryBot::AttributeList
- Includes:
- Enumerable
- Defined in:
- lib/factory_bot/attribute_list.rb
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.
Instance Method Summary collapse
- #apply_attributes(attributes_to_apply) ⇒ Object private
- #associations ⇒ Object private
- #define_attribute(attribute) ⇒ Object private
- #each(&block) ⇒ Object private
- #ignored ⇒ Object private
-
#initialize(name = nil, attributes = []) ⇒ AttributeList
constructor
private
A new instance of AttributeList.
- #names ⇒ Object private
- #non_ignored ⇒ Object private
Constructor Details
#initialize(name = nil, attributes = []) ⇒ AttributeList
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 AttributeList.
6 7 8 9 |
# File 'lib/factory_bot/attribute_list.rb', line 6 def initialize(name = nil, attributes = []) @name = name @attributes = attributes end |
Instance Method Details
#apply_attributes(attributes_to_apply) ⇒ Object
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.
38 39 40 |
# File 'lib/factory_bot/attribute_list.rb', line 38 def apply_attributes(attributes_to_apply) attributes_to_apply.each { |attribute| add_attribute(attribute) } end |
#associations ⇒ Object
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.
26 27 28 |
# File 'lib/factory_bot/attribute_list.rb', line 26 def associations AttributeList.new(@name, select(&:association?)) end |
#define_attribute(attribute) ⇒ Object
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.
11 12 13 14 15 16 |
# File 'lib/factory_bot/attribute_list.rb', line 11 def define_attribute(attribute) ensure_attribute_not_self_referencing! attribute ensure_attribute_not_defined! attribute add_attribute attribute end |
#each(&block) ⇒ Object
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.
18 19 20 |
# File 'lib/factory_bot/attribute_list.rb', line 18 def each(&block) @attributes.each(&block) end |
#ignored ⇒ Object
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.
30 31 32 |
# File 'lib/factory_bot/attribute_list.rb', line 30 def ignored AttributeList.new(@name, select(&:ignored)) end |
#names ⇒ Object
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.
22 23 24 |
# File 'lib/factory_bot/attribute_list.rb', line 22 def names map(&:name) end |
#non_ignored ⇒ Object
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.
34 35 36 |
# File 'lib/factory_bot/attribute_list.rb', line 34 def non_ignored AttributeList.new(@name, reject(&:ignored)) end |