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.



62
63
64
65
66
67
68
69
70
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 62

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)


72
73
74
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 72

def changed?
  value.changed?
end

#changesObject



76
77
78
# File 'lib/ledger_sync/resource_attribute/reference/many.rb', line 76

def changes
  value.changes
end

#saveObject



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

def save
  value.save
end