Module: LunaPark::Extensions::Comparable::ClassMethods
- Defined in:
- lib/luna_park/extensions/comparable.rb
Instance Method Summary collapse
-
#comparable_attributes(*names) ⇒ Object
Describe methods list that will be used for comparsion via ‘#==` method.
-
#comparable_attributes_list ⇒ Object
List of methods that will be used for comparsion via ‘#==` method.
-
#enable_debug ⇒ Object
(also: #debug)
Enable debug mode (just include debug methods).
Instance Method Details
#comparable_attributes(*names) ⇒ Object
Describe methods list that will be used for comparsion via ‘#==` method
44 45 46 47 48 49 |
# File 'lib/luna_park/extensions/comparable.rb', line 44 def comparable_attributes(*names) raise 'No attributes given' if names.compact.empty? @comparable_attributes_list ||= [] @comparable_attributes_list |= names end |
#comparable_attributes_list ⇒ Object
List of methods that will be used for comparsion via ‘#==` method
53 54 55 56 57 58 |
# File 'lib/luna_park/extensions/comparable.rb', line 53 def comparable_attributes_list return @comparable_attributes_list if @comparable_attributes_list raise Errors::NotConfigured, "You must set at least one comparable attribute using #{self}.comparable_attributes(*names)" end |
#enable_debug ⇒ Object Also known as: debug
Enable debug mode (just include debug methods)
35 36 37 38 |
# File 'lib/luna_park/extensions/comparable.rb', line 35 def enable_debug include ComparableDebug unless include?(ComparableDebug) self end |