Module: SequencescapeExcel::Helpers::Attributes

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Model, ActiveRecord::AttributeAssignment, Comparable
Included in:
SampleManifestExcel::ManifestTypeList::ManifestType, Column, ConditionalFormatting, ConditionalFormattingDefault, Formula, Range, Validation
Defined in:
app/sequencescape_excel/sequencescape_excel/helpers/attributes.rb

Overview

Just a little bit of extra help to add ActiveModel::Model. Attribute accessors and default attributes can be created.

Defined Under Namespace

Modules: ClassMethods

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 'app/sequencescape_excel/sequencescape_excel/helpers/attributes.rb', line 41

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

  to_a <=> other.to_a
end

#to_aObject

Push all of the instance variables onto an array useful for comparison.


34
35
36
# File 'app/sequencescape_excel/sequencescape_excel/helpers/attributes.rb', line 34

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