Class: FactoryGirl::Attribute

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/factory_girl/attribute.rb,
lib/factory_girl/attribute/static.rb,
lib/factory_girl/attribute/dynamic.rb,
lib/factory_girl/attribute/callback.rb,
lib/factory_girl/attribute/implicit.rb,
lib/factory_girl/attribute/sequence.rb,
lib/factory_girl/attribute/association.rb

Overview

:nodoc:

Direct Known Subclasses

Association, Callback, Dynamic, Implicit, Sequence, Static

Defined Under Namespace

Classes: Association, Callback, Dynamic, Implicit, Sequence, Static

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Attribute

Returns a new instance of Attribute.



15
16
17
18
19
20
21
22
23
24
# File 'lib/factory_girl/attribute.rb', line 15

def initialize(name)
  @name = name.to_sym

  if @name.to_s =~ /=$/
    attribute_name = $`
    raise AttributeDefinitionError,
      "factory_girl uses 'f.#{attribute_name} value' syntax " +
      "rather than 'f.#{attribute_name} = value'"
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#<=>(another) ⇒ Object



37
38
39
40
# File 'lib/factory_girl/attribute.rb', line 37

def <=>(another)
  return nil unless another.is_a? Attribute
  self.priority <=> another.priority
end

#add_to(proxy) ⇒ Object



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

def add_to(proxy)
end

#association?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/factory_girl/attribute.rb', line 29

def association?
  false
end

#priorityObject



33
34
35
# File 'lib/factory_girl/attribute.rb', line 33

def priority
  1
end