Module: Sinclair::Comparable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Options
- Defined in:
- lib/sinclair/comparable.rb,
lib/sinclair/comparable/class_methods.rb
Overview
Concern to be added on classes for easy == comparison
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Checks if an instance of a comparable is equals another.
Instance Method Details
#==(other) ⇒ Boolean
Checks if an instance of a comparable is equals another
37 38 39 40 41 42 43 44 45 |
# File 'lib/sinclair/comparable.rb', line 37 def ==(other) klass = self.class superklass = klass.superclass return false unless klass.equals_checker.match?(self, other) return true unless superklass.include?(Sinclair::Comparable) superklass.equals_checker.match?(self, other) end |