Class: FactoryGirl::Attribute::Association

Inherits:
FactoryGirl::Attribute show all
Defined in:
lib/factory_girl/attribute/association.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Attributes inherited from FactoryGirl::Attribute

#ignored, #name

Instance Method Summary collapse

Methods inherited from FactoryGirl::Attribute

#add_to, #alias_for?

Constructor Details

#initialize(name, factory, overrides) ⇒ Association

Returns a new instance of Association.



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

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

Instance Attribute Details

#factoryObject (readonly)

Returns the value of attribute factory.



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

def factory
  @factory
end

Instance Method Details

#association?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/factory_girl/attribute/association.rb', line 18

def association?
  true
end

#to_proc(proxy) ⇒ Object



12
13
14
15
16
# File 'lib/factory_girl/attribute/association.rb', line 12

def to_proc(proxy)
  factory   = @factory
  overrides = @overrides
  lambda { proxy.association(factory, overrides) }
end