Module: KeyTree::Loader
- Defined in:
- lib/key_tree/loader.rb
Overview
Module to manage key tree loaders
Constant Summary collapse
- BUILTIN_LOADERS =
{ json: 'JSON', yaml: 'YAML', yml: 'YAML' }.freeze
Class Method Summary collapse
Class Method Details
.[](loader_type) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/key_tree/loader.rb', line 9 def self.[](loader_type) @loaders ||= BUILTIN_LOADERS.each_with_object({}) do |pair, result| type, name = pair result[type] = const_get(name) if const_defined?(name) end @loaders[loader_type] end |
.[]=(type, loader_class) ⇒ Object
17 18 19 |
# File 'lib/key_tree/loader.rb', line 17 def self.[]=(type, loader_class) @loaders[type] = loader_class end |