Sha256: 70f768ca23ed3854752c60b988c0464605c72992d8cecbe55492f3639e66c252

Contents?: true

Size: 476 Bytes

Versions: 10

Compression:

Stored size: 476 Bytes

Contents

# frozen_string_literal: true

require 'securerandom'

module Attr
  module Gather
    module Concerns
      # Makes an entity identifiable by adding a #uuid attribute
      #
      # @!attribute [r] uuid
      #   @return [String] UUID of the result
      module Identifiable
        def initialize(*)
          @uuid = SecureRandom.uuid
          super
        end

        def self.included(klass)
          klass.attr_reader(:uuid)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
attr-gather-1.5.1 lib/attr/gather/concerns/identifiable.rb
attr-gather-1.4.0 lib/attr/gather/concerns/identifiable.rb
attr-gather-1.2.1 lib/attr/gather/concerns/identifiable.rb
attr-gather-1.3.0 lib/attr/gather/concerns/identifiable.rb
attr-gather-1.2.0 lib/attr/gather/concerns/identifiable.rb
attr-gather-1.1.3 lib/attr/gather/concerns/identifiable.rb
attr-gather-1.1.2 lib/attr/gather/concerns/identifiable.rb
attr-gather-1.1.1 lib/attr/gather/concerns/identifiable.rb
attr-gather-1.1.0 lib/attr/gather/concerns/identifiable.rb
attr-gather-1.0.0 lib/attr/gather/concerns/identifiable.rb