universe_compiler 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/universe_compiler/utils/graphviz.rb +14 -14
- data/lib/universe_compiler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da014c3e9cc37f1f99bbedb67688c7dbbe5a91e4
|
4
|
+
data.tar.gz: d2cffc16ba1d162ba824861ecf44b4f9a05d4dde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b566f2070273cbecb289d6023bab4fd8ac968db544095a580cf3ba1fafbc55926e22efed42726abc454c9937737aba901696679ca3058234d0836c78c463e19
|
7
|
+
data.tar.gz: 92c74c7f20d6bf36c5227ef7279467fb655f9c82e4b117ad62403d1cdb423782c8bc3698250eef489cfa1d9404b52afb7a6998baa935cc920c2c7ae952d292ff
|
@@ -22,7 +22,7 @@ module UniverseCompiler
|
|
22
22
|
cache[:by_entity][entity] = node
|
23
23
|
cache[:by_node][node] = entity
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
# Building relations
|
27
27
|
entities.each do |entity|
|
28
28
|
entity.class.fields_constraints.each do |field_name, field_constraints|
|
@@ -30,10 +30,10 @@ module UniverseCompiler
|
|
30
30
|
case constraint_name
|
31
31
|
when :has_one
|
32
32
|
target = entity[field_name]
|
33
|
-
g.add_edges cache[:by_entity][entity], cache[:by_entity][target] unless
|
33
|
+
g.add_edges cache[:by_entity][entity], cache[:by_entity][target] unless entities.include? target
|
34
34
|
when :has_many
|
35
35
|
entity[field_name].each do |target|
|
36
|
-
g.add_edges cache[:by_entity][entity], cache[:by_entity][target]
|
36
|
+
g.add_edges cache[:by_entity][entity], cache[:by_entity][target] unless entities.include? target
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -55,17 +55,17 @@ module UniverseCompiler
|
|
55
55
|
file_ext = (file_ext.start_with? '.') ? file_ext : ".#{file_ext}"
|
56
56
|
|
57
57
|
output_file_name = case output_file_name
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
58
|
+
when NilClass
|
59
|
+
file = Tempfile.create ['entities_graph', file_ext]
|
60
|
+
file.close
|
61
|
+
file.path
|
62
|
+
when String
|
63
|
+
if output_file_name.end_with? file_ext
|
64
|
+
output_file_name
|
65
|
+
else
|
66
|
+
"#{output_file_name}#{file_ext}"
|
67
|
+
end
|
68
|
+
end
|
69
69
|
|
70
70
|
if generate_file
|
71
71
|
g.output( file_type => output_file_name )
|