Class: FactoryTrace::Structures::Factory
- Inherits:
-
Object
- Object
- FactoryTrace::Structures::Factory
- Defined in:
- lib/factory_trace/structures/factory.rb
Instance Attribute Summary collapse
-
#alias_names ⇒ Object
readonly
Returns the value of attribute alias_names.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent_name ⇒ Object
readonly
Returns the value of attribute parent_name.
-
#trait_names ⇒ Object
readonly
Returns the value of attribute trait_names.
Instance Method Summary collapse
- #==(factory) ⇒ Boolean
-
#initialize(name, parent_name, trait_names, alias_names) ⇒ Factory
constructor
A new instance of Factory.
-
#merge!(factory) ⇒ FactoryTrace::Structures::Factory
Merge passed factory into self.
- #to_h ⇒ Hash<Symbol, String>
Constructor Details
#initialize(name, parent_name, trait_names, alias_names) ⇒ Factory
Returns a new instance of Factory.
10 11 12 13 14 15 |
# File 'lib/factory_trace/structures/factory.rb', line 10 def initialize(name, parent_name, trait_names, alias_names) @name = name @parent_name = parent_name @trait_names = trait_names @alias_names = alias_names end |
Instance Attribute Details
#alias_names ⇒ Object (readonly)
Returns the value of attribute alias_names.
4 5 6 |
# File 'lib/factory_trace/structures/factory.rb', line 4 def alias_names @alias_names end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/factory_trace/structures/factory.rb', line 4 def name @name end |
#parent_name ⇒ Object (readonly)
Returns the value of attribute parent_name.
4 5 6 |
# File 'lib/factory_trace/structures/factory.rb', line 4 def parent_name @parent_name end |
#trait_names ⇒ Object (readonly)
Returns the value of attribute trait_names.
4 5 6 |
# File 'lib/factory_trace/structures/factory.rb', line 4 def trait_names @trait_names end |
Instance Method Details
#==(factory) ⇒ Boolean
37 38 39 40 41 42 43 44 |
# File 'lib/factory_trace/structures/factory.rb', line 37 def ==(factory) return false unless factory.is_a?(FactoryTrace::Structures::Factory) name == factory.name && parent_name == factory.parent_name && trait_names == factory.trait_names && alias_names == factory.alias_names end |
#merge!(factory) ⇒ FactoryTrace::Structures::Factory
Merge passed factory into self
32 33 34 |
# File 'lib/factory_trace/structures/factory.rb', line 32 def merge!(factory) @trait_names = (trait_names + factory.trait_names).uniq end |
#to_h ⇒ Hash<Symbol, String>
18 19 20 21 22 23 24 25 |
# File 'lib/factory_trace/structures/factory.rb', line 18 def to_h { name: name, parent_name: parent_name, trait_names: trait_names, alias_names: alias_names } end |