Class: FactoryGirl::Attribute::Association Private

Inherits:
FactoryGirl::Attribute show all
Defined in:
lib/factory_girl/attribute/association.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 Attribute Summary collapse

Attributes inherited from FactoryGirl::Attribute

#ignored, #name

Instance Method Summary collapse

Methods inherited from FactoryGirl::Attribute

#alias_for?

Constructor Details

#initialize(name, factory, overrides) ⇒ Association

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 Association



7
8
9
10
11
# File 'lib/factory_girl/attribute/association.rb', line 7

def initialize(name, factory, overrides)
  super(name, false)
  @factory   = factory
  @overrides = overrides
end

Instance Attribute Details

#factoryObject (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.



5
6
7
# File 'lib/factory_girl/attribute/association.rb', line 5

def factory
  @factory
end

Instance Method Details

#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.



22
23
24
# File 'lib/factory_girl/attribute/association.rb', line 22

def association?
  true
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.



13
14
15
16
17
18
19
20
# File 'lib/factory_girl/attribute/association.rb', line 13

def to_proc
  factory   = @factory
  overrides = @overrides
  traits_and_overrides = [factory, overrides].flatten
  factory_name = traits_and_overrides.shift

  -> { association(factory_name, *traits_and_overrides) }
end