Sha256: 49a222c378bd856d156a211438e6997998be6f0cbd404de5d366235a74d8a7aa

Contents?: true

Size: 982 Bytes

Versions: 1

Compression:

Stored size: 982 Bytes

Contents

# frozen_string_literal: true

module DevSuite
  module Utils
    module FileLoader
      module Loader
        require_relative "loader/base"
        require_relative "loader/text"
        require_relative "loader/json"
        require_relative "loader/yaml"

        class << self
          def registry_loaders(registry, loader_symbols)
            loader_classes = map_loaders(loader_symbols)
            loader_classes.each do |loader|
              registry.register(loader)
            end
            registry
          end

          private

          def map_loaders(loader_symbols)
            loader_symbols.map do |symbol|
              case symbol
              when :json
                Loader::Json
              when :text
                Loader::Text
              when :yaml
                Loader::Yaml
              else
                raise "Unknown loader: #{symbol}"
              end
            end
          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/loader.rb