Module: KeyTree::Loader
- Defined in:
- lib/key_tree/loader.rb,
lib/key_tree/loader/nil.rb
Overview
Module to manage key tree loaders
Defined Under Namespace
Modules: Nil
Constant Summary collapse
- BUILTIN_LOADERS =
{ json: 'JSON', yaml: 'YAML', yml: 'YAML' }.freeze
Class Attribute Summary collapse
-
.fallback ⇒ Object
(also: fallback)
writeonly
Sets the attribute fallback.
-
.loaders ⇒ Object
writeonly
Sets the attribute loaders.
Class Method Summary collapse
Class Attribute Details
.fallback=(value) ⇒ Object (writeonly) Also known as: fallback
Sets the attribute fallback
24 25 26 |
# File 'lib/key_tree/loader.rb', line 24 def fallback=(value) @fallback = value end |
.loaders=(value) ⇒ Object
Sets the attribute loaders
24 25 26 |
# File 'lib/key_tree/loader.rb', line 24 def loaders=(value) @loaders = value end |
Class Method Details
.[](type) ⇒ Object
14 15 16 17 |
# File 'lib/key_tree/loader.rb', line 14 def [](type) type = type.to_sym if type.respond_to?(:to_sym) loaders[type] || @fallback end |
.[]=(type, loader_class) ⇒ Object
19 20 21 22 |
# File 'lib/key_tree/loader.rb', line 19 def []=(type, loader_class) type = type.to_sym if type.respond_to?(:to_sym) loaders[type] = loader_class end |