Sha256: d86e8d88df1438a3040a19aea013fa32e36d7c7d9d6af8e07c3c6a626682d349

Contents?: true

Size: 907 Bytes

Versions: 1

Compression:

Stored size: 907 Bytes

Contents

# frozen_string_literal: true

module DevSuite
  module Utils
    module FileLoader
      module Config
        class Configuration < BaseConfiguration
          config_attr :loaders, default_value: [:text, :json, :yaml], type: :array

          register_hook :after_initialize do
            setup_registry
          end

          # Expose the registry as a read-only attribute
          attr_reader :registry

          # Setup the registry based on the current loaders
          def setup_registry
            @registry = LoaderRegistry.new
            update_registry(loaders)
          end

          # Update the registry with the provided loaders
          def update_registry(loaders)
            @registry ||= LoaderRegistry.new
            @registry.clear # Clear the existing registry
            Loader.registry_loaders(@registry, loaders)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dev_suite-0.2.5 lib/dev_suite/utils/file_loader/config/configuration.rb