metatron 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/metatron/template.rb +11 -1
- data/lib/metatron/version.rb +1 -1
- 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: 668fa30d73c500f1a677d0424c480218b6438f75ff3fe1f369dbe81963d53dc3
|
4
|
+
data.tar.gz: 2d71d21bf0555ba052f34465d9b27c2dfe4f33c06e9383a74b225888c5b40b5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4859616cbe9ab91e9bd3d7595c44034ff80db1ebef4b7c08371b87d9cc32b4dc03b1a0afc0cca02b5dfe489f1c8015ebc4f42fa04d6cd6688f5795591fb8c20
|
7
|
+
data.tar.gz: ec29f2ea71f5692427e857b72b7636087f257e9ecb963eea7895d10c37cd6032c61b9ba2868c9f055076cd4e10ad0f0c8ce9a2431431c20ccc34a42c33755ce8
|
data/Gemfile.lock
CHANGED
data/lib/metatron/template.rb
CHANGED
@@ -18,7 +18,7 @@ module Metatron
|
|
18
18
|
@name = name
|
19
19
|
@label_namespace = self.class.label_namespace
|
20
20
|
@api_version = "v1"
|
21
|
-
@kind =
|
21
|
+
@kind = find_kind
|
22
22
|
run_initializers
|
23
23
|
end
|
24
24
|
|
@@ -38,5 +38,15 @@ module Metatron
|
|
38
38
|
def run_initializers
|
39
39
|
self.class.initializers.each { |initializer| send(initializer.to_sym) }
|
40
40
|
end
|
41
|
+
|
42
|
+
def find_kind
|
43
|
+
return self.class.name.split("::").last if metatron_template?
|
44
|
+
|
45
|
+
self.class.ancestors.find { |klass| metatron_template?(klass) }.name.split("::").last
|
46
|
+
end
|
47
|
+
|
48
|
+
def metatron_template?(klass = self)
|
49
|
+
klass.name.include?("Metatron::Templates") && !klass.name.include?("Concerns")
|
50
|
+
end
|
41
51
|
end
|
42
52
|
end
|
data/lib/metatron/version.rb
CHANGED