Sha256: 9614dafc3b77d2a4b6718efd5b2b8467982c7e2014d0253cf2f89b784eca8622

Contents?: true

Size: 898 Bytes

Versions: 13

Compression:

Stored size: 898 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'eac_ruby_utils/gems_registry'

module Avm
  module Registry
    require_sub __FILE__
    enable_listable
    lists.add_symbol :category, :instance_stereotypes, :runners, :scms, :sources

    WITH_PATH = [CATEGORY_SCMS, CATEGORY_SOURCES].freeze

    class << self
      enable_simple_cache

      # @return [Array<Avm::Registry::Base>]
      def registries
        lists.category.values.map { |c| send(c) }
      end

      private

      ::Avm::Registry.lists.category.each_value do |category|
        define_method "#{category}_uncached" do
          registry_class(category).new(category.to_s.camelize)
        end
      end

      def registry_class(category)
        if WITH_PATH.include?(category)
          ::Avm::Registry::WithPath
        else
          ::Avm::Registry::Base
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
avm-0.26.0 lib/avm/registry.rb
eac_tools-0.8.0 sub/avm/lib/avm/registry.rb
eac_tools-0.7.0 sub/avm/lib/avm/registry.rb
avm-0.25.0 lib/avm/registry.rb
eac_tools-0.6.0 sub/avm/lib/avm/registry.rb
eac_tools-0.5.0 sub/avm/lib/avm/registry.rb
avm-0.24.0 lib/avm/registry.rb
eac_tools-0.4.0 sub/avm/lib/avm/registry.rb
eac_tools-0.3.0 sub/avm/lib/avm/registry.rb
eac_tools-0.2.2 sub/avm/lib/avm/registry.rb
avm-0.23.0 lib/avm/registry.rb
avm-0.22.0 lib/avm/registry.rb
avm-tools-0.120.0 sub/avm/lib/avm/registry.rb