Class: DevSuite::Utils::FileLoader::LoaderRegistry
- Inherits:
-
Object
- Object
- DevSuite::Utils::FileLoader::LoaderRegistry
- Defined in:
- lib/dev_suite/utils/file_loader/loader_registry.rb
Instance Method Summary collapse
- #clear ⇒ Object
- #find_loader(extension) ⇒ Object
-
#initialize ⇒ LoaderRegistry
constructor
A new instance of LoaderRegistry.
- #register(loader_class) ⇒ Object
- #registered_extensions ⇒ Object
- #registered_loaders ⇒ Object
Constructor Details
#initialize ⇒ LoaderRegistry
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
#clear ⇒ Object
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_extensions ⇒ Object
26 27 28 |
# File 'lib/dev_suite/utils/file_loader/loader_registry.rb', line 26 def registered_extensions @registry.keys end |
#registered_loaders ⇒ Object
30 31 32 |
# File 'lib/dev_suite/utils/file_loader/loader_registry.rb', line 30 def registered_loaders @registry.values.uniq end |