Module: Accession::Equality

Includes:
Comparable
Included in:
Configuration, Tag
Defined in:
lib/accession/accession.rb

Overview

rubocop:todo Style/Documentation

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object

Two objects are comparable if all of their instance variables that are present are comparable.


41
42
43
44
45
# File 'lib/accession/accession.rb', line 41

def <=>(other)
  return unless other.is_a?(self.class)

  to_a <=> other.to_a
end

#to_aObject


34
35
36
# File 'lib/accession/accession.rb', line 34

def to_a
  attributes.filter_map { |v| instance_variable_get("@#{v}") }
end