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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/key_tree/loader.rb +13 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 173c5891978625d7465eda060527e347d2b027398ee4cd91c295515acd7f0e51
4
- data.tar.gz: 4cad395ecbe13ad5e515e59c0a8fc9b19328590280623d95d1537358bd7ba821
3
+ metadata.gz: 6661a5ff2ab865701d5faf28ab7a1b39eeca9c5ae986f408423ef51bd7f404dc
4
+ data.tar.gz: dc196a3c4cab97eb0ca140bd0bf37b7e391d0c59f7de54f1450b3cfec8c6f5b9
5
5
  SHA512:
6
- metadata.gz: 8adf5ecf6a524a71d9dfb1989f5a9410a6b50ab63eed51c45abb07a434748343ef4e83e26fbec860876ee32f366ed2d78440eeb5f20257e8b873e37f4a34b502
7
- data.tar.gz: b45dbebd32d4b54dbe9c38760e362cb41773d400d6859f7913eb052bd86c58a514539bfc58f204e10b119446d757bee089b80fd8cfdb3d0d596b7482fd74a95c
6
+ metadata.gz: 0707c5fee05e7e28222383b1b1a34a4286f7cbdf7619ad3574c1cabc479ed9f8a5a7459e3bb65a349f5485dd790b2296f752daa6d239c1e4ab8522da01cfa108
7
+ data.tar.gz: f16bf85bf8dc03949d9fe785bfc16a3e01bb57b71158a14655f79e2f7f39703600304a315afd4086cf46ff73aff5cb5161d5931a1a3ba09d4587bea61d9dac6c
@@ -6,16 +6,23 @@ module KeyTree
6
6
  yaml: 'YAML', yml: 'YAML'
7
7
  }.freeze
8
8
 
9
- def self.[](loader_type)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: key_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Calle Englund