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, #resource_class, #type, #value

Instance Method Summary collapse

Methods inherited from LedgerSync::ResourceAttribute

#assert_valid, #cast, #reference?, #references_many?, #valid_with?, #will_change?

Methods included from Util::Mixins::DupableMixin

#dup

Constructor Details

#initialize(args = {}) ⇒ Many

Returns a new instance of Many.



70
71
72
73
74
75
76
77
78
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 70

def initialize(args = {})
  to = args.fetch(:to)
  super(
    args.except(:to).merge(
      type: Type::ReferenceMany.new(resource_class: to),
      value: ManyArray.new
    )
  )
end

Instance Method Details

#changed?Boolean

Returns:

  • (Boolean)


80
81
82
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 80

def changed?
  value.changed?
end

#changesObject



84
85
86
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 84

def changes
  value.changes
end

#saveObject



88
89
90
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 88

def save
  value.save
end