Class: FactoryGirl::Attribute
- Inherits:
-
Object
- Object
- FactoryGirl::Attribute
- 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
Defined Under Namespace
Classes: Association, Dynamic, Sequence, Static
Instance Attribute Summary collapse
-
#ignored ⇒ Object
readonly
Returns the value of attribute ignored.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #add_to(proxy) ⇒ Object
- #alias_for?(attr) ⇒ Boolean
- #association? ⇒ Boolean
-
#initialize(name, ignored) ⇒ Attribute
constructor
A new instance of Attribute.
- #to_proc(proxy) ⇒ Object
Constructor Details
#initialize(name, ignored) ⇒ Attribute
Returns a new instance of Attribute.
11 12 13 14 15 |
# File 'lib/factory_girl/attribute.rb', line 11 def initialize(name, ignored) @name = name.to_sym @ignored = ignored ensure_non_attribute_writer! end |
Instance Attribute Details
#ignored ⇒ Object (readonly)
Returns the value of attribute ignored.
9 10 11 |
# File 'lib/factory_girl/attribute.rb', line 9 def ignored @ignored end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/factory_girl/attribute.rb', line 9 def name @name end |
Instance Method Details
#add_to(proxy) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/factory_girl/attribute.rb', line 17 def add_to(proxy) if @ignored proxy.set_ignored(self, to_proc(proxy)) else proxy.set(self, to_proc(proxy)) end end |
#alias_for?(attr) ⇒ Boolean
33 34 35 |
# File 'lib/factory_girl/attribute.rb', line 33 def alias_for?(attr) FactoryGirl.aliases_for(attr).include?(name) end |
#association? ⇒ Boolean
29 30 31 |
# File 'lib/factory_girl/attribute.rb', line 29 def association? false end |
#to_proc(proxy) ⇒ Object
25 26 27 |
# File 'lib/factory_girl/attribute.rb', line 25 def to_proc(proxy) lambda { } end |