Class: DevSuite::Utils::FileLoader::LoaderRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/dev_suite/utils/file_loader/loader_registry.rb

Instance Method Summary collapse

Constructor Details

#initializeLoaderRegistry

Returns a new instance of LoaderRegistry.



7
8
9
# File 'lib/dev_suite/utils/file_loader/loader_registry.rb', line 7

def initialize
  @registry = {}
end

Instance Method Details

#clearObject



18
19
20
# File 'lib/dev_suite/utils/file_loader/loader_registry.rb', line 18

def clear
  @registry.clear
end

#find_loader(extension) ⇒ Object



22
23
24
# File 'lib/dev_suite/utils/file_loader/loader_registry.rb', line 22

def find_loader(extension)
  @registry[extension]
end

#register(loader_class) ⇒ Object



11
12
13
14
15
16
# File 'lib/dev_suite/utils/file_loader/loader_registry.rb', line 11

def register(loader_class)
  loader = loader_class.new
  loader_class.extensions.each do |ext|
    @registry[ext] = loader
  end
end

#registered_extensionsObject



26
27
28
# File 'lib/dev_suite/utils/file_loader/loader_registry.rb', line 26

def registered_extensions
  @registry.keys
end

#registered_loadersObject



30
31
32
# File 'lib/dev_suite/utils/file_loader/loader_registry.rb', line 30

def registered_loaders
  @registry.values.uniq
end