Sha256: 47007ad834c469af38763e53103fe2049a72889b2388993da8b957b70697cb65

Contents?: true

Size: 410 Bytes

Versions: 20

Compression:

Stored size: 410 Bytes

Contents

# frozen_string_literal: true

module Spandx
  module Core
    module Registerable
      include Enumerable

      def all
        @all ||= registry.map(&:new)
      end

      def each(&block)
        all.each do |x|
          block.call(x)
        end
      end

      def inherited(subclass)
        registry.push(subclass)
      end

      def registry
        @registry ||= []
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
spandx-0.18.3 lib/spandx/core/registerable.rb
spandx-0.18.2 lib/spandx/core/registerable.rb
spandx-0.18.1 lib/spandx/core/registerable.rb
spandx-0.18.0 lib/spandx/core/registerable.rb
spandx-0.17.0 lib/spandx/core/registerable.rb
spandx-0.16.1 lib/spandx/core/registerable.rb
spandx-0.16.0 lib/spandx/core/registerable.rb
spandx-0.15.1 lib/spandx/core/registerable.rb
spandx-0.15.0 lib/spandx/core/registerable.rb
spandx-0.14.0 lib/spandx/core/registerable.rb
spandx-0.13.5 lib/spandx/core/registerable.rb
spandx-0.13.4 lib/spandx/core/registerable.rb
spandx-0.13.3 lib/spandx/core/registerable.rb
spandx-0.13.2 lib/spandx/core/registerable.rb
spandx-0.13.1 lib/spandx/core/registerable.rb
spandx-0.13.0 lib/spandx/core/registerable.rb
spandx-0.12.3 lib/spandx/core/registerable.rb
spandx-0.12.2 lib/spandx/core/registerable.rb
spandx-0.12.1 lib/spandx/core/registerable.rb
spandx-0.12.0 lib/spandx/core/registerable.rb