Class: FactoryGirl::Trait
- Inherits:
-
Object
- Object
- FactoryGirl::Trait
- Defined in:
- lib/factory_girl/trait.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, &block) ⇒ Trait
constructor
:nodoc:.
- #names ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Trait
:nodoc:
5 6 7 8 9 10 11 12 |
# File 'lib/factory_girl/trait.rb', line 5 def initialize(name, &block) #:nodoc: @name = name @block = block @definition = Definition.new proxy = FactoryGirl::DefinitionProxy.new(@definition) proxy.instance_eval(&@block) if block_given? end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/factory_girl/trait.rb', line 3 def name @name end |
Instance Method Details
#==(other) ⇒ Object
21 22 23 24 |
# File 'lib/factory_girl/trait.rb', line 21 def ==(other) name == other.name && block == other.block end |
#names ⇒ Object
17 18 19 |
# File 'lib/factory_girl/trait.rb', line 17 def names [@name] end |