Class: LedgerSync::Serialization::DeserializerAttributeSet

Inherits:
Object
  • Object
show all
Includes:
AttributeSetMixin
Defined in:
lib/ledger_sync/serialization/deserializer_attribute_set.rb

Instance Attribute Summary

Attributes included from AttributeSetMixin

#attributes, #serializer_class

Instance Method Summary collapse

Methods included from AttributeSetMixin

#hash_attribute?, #initialize

Methods included from Util::Mixins::DelegateIterableMethodsMixin

included

Instance Method Details

#add(attribute) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/ledger_sync/serialization/deserializer_attribute_set.rb', line 10

def add(attribute)
  raise 'resource_attribute is missing' unless attribute.resource_attribute.present?

  if attributes.key?(attribute.resource_attribute.to_s)
    raise "resource_attribute already defined for #{serializer_class.name}: #{attribute.resource_attribute}"
  end

  @attributes[attribute.resource_attribute] = attribute
  attribute
end