Sha256: 4d0d68f3529e40303c96ba96a0720947186059595bae9dc56feca6e09b535d79

Contents?: true

Size: 568 Bytes

Versions: 1

Compression:

Stored size: 568 Bytes

Contents

# frozen_string_literal: true

require_relative 'attribute_set_mixin'

module LedgerSync
  class Serialization
    class SerializerAttributeSet
      include AttributeSetMixin

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

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

        @attributes[attribute.hash_attribute] = attribute
        attribute
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ledger_sync-1.3.5 lib/ledger_sync/serialization/serializer_attribute_set.rb