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

Inherits:
Object
  • 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 Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeManyArray

Returns a new instance of ManyArray.



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

def initialize
  @value = []
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



21
22
23
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 21

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



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

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

  true
end

#saveObject



43
44
45
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 43

def save
  changes_applied
end

#sorted_fingerprintsObject



47
48
49
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 47

def sorted_fingerprints
  value.map(&:fingerprint).sort
end