Module: Yast2::Equatable::ClassMethods
- Defined in:
- library/general/src/lib/yast2/equatable.rb
Overview
Class methods for defining the attributes to consider when comparing objects
Instance Method Summary collapse
-
#eql_attr(*names) ⇒ Object
Saves the name of the attributes to use when comparing objects.
-
#eql_attrs ⇒ Array<Symbol>
Name of the attributes to consider when comparing objects.
-
#inherited(subclass) ⇒ Object
Inherited classes must remember the attributes for comparison from its parent class.
Instance Method Details
#eql_attr(*names) ⇒ Object
Saves the name of the attributes to use when comparing objects
81 82 83 84 |
# File 'library/general/src/lib/yast2/equatable.rb', line 81 def eql_attr(*names) @eql_attrs ||= [] @eql_attrs += names end |
#eql_attrs ⇒ Array<Symbol>
Name of the attributes to consider when comparing objects
74 75 76 |
# File 'library/general/src/lib/yast2/equatable.rb', line 74 def eql_attrs @eql_attrs || [] end |
#inherited(subclass) ⇒ Object
Inherited classes must remember the attributes for comparison from its parent class
65 66 67 68 69 |
# File 'library/general/src/lib/yast2/equatable.rb', line 65 def inherited(subclass) super subclass.eql_attr(*eql_attrs) end |