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

Inherits:
LedgerSync::ResourceAttribute::Reference show all
Defined in:
lib/ledger_sync/resource_attribute/reference/many.rb

Defined Under Namespace

Modules: Mixin Classes: ManyArray

Instance Attribute Summary

Attributes inherited from LedgerSync::ResourceAttribute

#name, #reference, #type, #value

Instance Method Summary collapse

Methods inherited from LedgerSync::ResourceAttribute

#cast, #reference?, #references_many?, #valid_with?

Constructor Details

#initialize(name:, to:) ⇒ Many

Returns a new instance of Many.



66
67
68
69
70
71
72
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 66

def initialize(name:, to:)
  super(
    name: name,
    type: Type::ReferenceMany.new(resource_class: to),
    value: ManyArray.new
  )
end

Instance Method Details

#changed?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 74

def changed?
  value.changed?
end

#changesObject



78
79
80
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 78

def changes
  value.changes
end

#saveObject



82
83
84
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 82

def save
  value.save
end