universe_compiler 0.2.15 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c53fdf41edd21c2f42d95cbe571ad2144e3024d
|
4
|
+
data.tar.gz: dd8f70ce2b215aa1210f8f57c59597979822e03d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48bddacf5d26a8a0dda4d7763a2ca57f7d591131964bae3951a4ba1c9242028bae7d0907612040f7795122c6f5269f7cca685c9131d52b9a7a2d200c17b39670
|
7
|
+
data.tar.gz: 18552dc3147935c98001999f901e7c7e46ead0e9f00c1f5fc9e3e2f0fba02a1a87e3b363bc1de9f10e5dd186d2a27d3a5736d9be7198c0149bff5b9ac1d70a8c
|
@@ -20,9 +20,17 @@ module UniverseCompiler
|
|
20
20
|
@auto_named_entity_type
|
21
21
|
end
|
22
22
|
|
23
|
-
def get_unique_name
|
24
|
-
|
25
|
-
|
23
|
+
def get_unique_name(universe)
|
24
|
+
return SecureRandom.uuid if universe.nil?
|
25
|
+
|
26
|
+
uniq_name = nil
|
27
|
+
loop do
|
28
|
+
@entity_type_counter += 1
|
29
|
+
raise UniverseCompiler::Error, "Too many '#{entity_type}' (> 999999) in universe '#{universe.name}'" if @entity_type_counter >= 1000000
|
30
|
+
uniq_name = '%s_%06u' % [auto_named_entity_type_seed, @entity_type_counter]
|
31
|
+
break if universe.get_entity(entity_type, uniq_name).nil?
|
32
|
+
end
|
33
|
+
uniq_name
|
26
34
|
end
|
27
35
|
|
28
36
|
end
|
@@ -29,10 +29,10 @@ module UniverseCompiler
|
|
29
29
|
self.universe = universe
|
30
30
|
self.fully_resolved = true
|
31
31
|
if universe.nil?
|
32
|
-
self.name = self.class.get_unique_name if self.class.auto_named_entity_type?
|
32
|
+
self.name = self.class.get_unique_name(nil) if self.class.auto_named_entity_type?
|
33
33
|
else
|
34
34
|
unless universe.compiled?
|
35
|
-
self.name = self.class.get_unique_name if self.class.auto_named_entity_type?
|
35
|
+
self.name = self.class.get_unique_name(universe) if self.class.auto_named_entity_type?
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|