key_tree 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/key_tree/loader.rb +13 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6661a5ff2ab865701d5faf28ab7a1b39eeca9c5ae986f408423ef51bd7f404dc
|
4
|
+
data.tar.gz: dc196a3c4cab97eb0ca140bd0bf37b7e391d0c59f7de54f1450b3cfec8c6f5b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0707c5fee05e7e28222383b1b1a34a4286f7cbdf7619ad3574c1cabc479ed9f8a5a7459e3bb65a349f5485dd790b2296f752daa6d239c1e4ab8522da01cfa108
|
7
|
+
data.tar.gz: f16bf85bf8dc03949d9fe785bfc16a3e01bb57b71158a14655f79e2f7f39703600304a315afd4086cf46ff73aff5cb5161d5931a1a3ba09d4587bea61d9dac6c
|
data/lib/key_tree/loader.rb
CHANGED
@@ -6,16 +6,23 @@ module KeyTree
|
|
6
6
|
yaml: 'YAML', yml: 'YAML'
|
7
7
|
}.freeze
|
8
8
|
|
9
|
-
def self.[](
|
9
|
+
def self.[](type)
|
10
|
+
type = type.to_sym if type.respond_to?(:to_sym)
|
11
|
+
loaders[type]
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.[]=(type, loader_class)
|
15
|
+
type = type.to_sym if type.respond_to?(:to_sym)
|
16
|
+
loaders[type] = loader_class
|
17
|
+
end
|
18
|
+
|
19
|
+
private_class_method
|
20
|
+
|
21
|
+
def self.loaders
|
10
22
|
@loaders ||= BUILTIN_LOADERS.each_with_object({}) do |pair, result|
|
11
23
|
type, name = pair
|
12
24
|
result[type] = const_get(name) if const_defined?(name)
|
13
25
|
end
|
14
|
-
@loaders[loader_type]
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.[]=(type, loader_class)
|
18
|
-
@loaders[type] = loader_class
|
19
26
|
end
|
20
27
|
end
|
21
28
|
end
|