module LunaPark::Extensions::Comparable::ClassMethods
Public Instance Methods
comparable_attributes(*names)
click to toggle source
Describe methods list that will be used for comparsion via `#==` method
# 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()
click to toggle source
List of methods that will be used for comparsion via `#==` method
# 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()
click to toggle source
Enable debug mode (just include debug methods)
# File lib/luna_park/extensions/comparable.rb, line 35 def enable_debug include ComparableDebug unless include?(ComparableDebug) self end
Also aliased as: debug
Private Instance Methods
inherited(child)
click to toggle source
Calls superclass method
# File lib/luna_park/extensions/comparable.rb, line 62 def inherited(child) super child.instance_variable_set(:@comparable_attributes_list, @comparable_attributes_list&.dup) end