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/sequence.rb,
lib/factory_girl/attribute/association.rb

Overview

:nodoc:

Direct Known Subclasses

Association, Dynamic, Sequence, Static

Defined Under Namespace

Classes: Association, Dynamic, Sequence, Static

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, ignored) ⇒ Attribute

Returns a new instance of Attribute.



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

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

Instance Attribute Details

#ignoredObject (readonly)

Returns the value of attribute ignored.



11
12
13
# File 'lib/factory_girl/attribute.rb', line 11

def ignored
  @ignored
end

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/factory_girl/attribute.rb', line 11

def name
  @name
end

Instance Method Details

#<=>(another) ⇒ Object



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

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

#==(another) ⇒ Object



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

def ==(another)
  self.object_id == another.object_id
end

#add_to(proxy) ⇒ Object



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

def add_to(proxy)
end

#aliases_for?(attr) ⇒ Boolean

Returns:

  • (Boolean)


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

def aliases_for?(attr)
  FactoryGirl.aliases_for(attr).include?(name)
end

#association?Boolean

Returns:

  • (Boolean)


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

def association?
  false
end

#priorityObject



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

def priority
  1
end