Class: LedgerSync::ResourceAttribute::Reference::Many::ManyArray

Inherits:
Array
  • Object
show all
Includes:
ActiveModel::Dirty
Defined in:
lib/ledger_sync/resource_attribute/reference/many.rb

Constant Summary collapse

ARRAY_METHODS_TO_OVERRIDE_WITH_DIRTY =
%w[<< | []= + -].freeze

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



24
25
26
27
28
29
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 24

def ==(other)
  return false unless other.is_a?(ManyArray) || other.is_a?(Array)
  return false unless sorted_fingerprints(other) == sorted_fingerprints

  true
end

#saveObject



31
32
33
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 31

def save
  changes_applied
end

#sorted_fingerprints(other = nil) ⇒ Object



35
36
37
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 35

def sorted_fingerprints(other = nil)
  (other || self).map(&:fingerprint).sort
end

#valueObject



39
40
41
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 39

def value
  self
end