fixture_fox 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fixture_fox/analyzer.rb +12 -12
- data/lib/fixture_fox/version.rb +1 -1
- data/lib/fixture_fox.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2df98a0f3709e924fc29ae7f8d155191bc5e6e49338e5f6673376f36bf3d0a1f
|
4
|
+
data.tar.gz: b578b8fbaeec78c200bc387de6d3cbbfa0a8d468131fea552329bb5088234085
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fbb05bacc4362fc47fee303969b9b0e621da953f8b8f9f21e62441121ce89f5ce4784d1242fa38a061d905bf865b1fb3db7b33bb76309eb1ddb2a424076f6ef
|
7
|
+
data.tar.gz: 9a7ff187e819d3f7f9ced5755df25382b7da9bb350fb1d9ac788ec8951d19b446b33eaf3cac6bf3883e44eabaff84b9b2b9fbd110e0fda43c479449e1593a24c
|
data/lib/fixture_fox/analyzer.rb
CHANGED
@@ -196,7 +196,7 @@ module FixtureFox
|
|
196
196
|
ast_ref.reference.error("Can't find anchor for reference '#{ast_ref.reference.litt}'")
|
197
197
|
anchor_types =
|
198
198
|
[anchor.type] +
|
199
|
-
(anchor.type.table.
|
199
|
+
(anchor.type.table.sub_table? ? [anchor.type.table.super_table.record_type] : [])
|
200
200
|
anchor_types.any? { |anchor_type| ast_ref.type == anchor_type } or
|
201
201
|
ast_ref.reference.error(
|
202
202
|
"Data type mismatch - expected a reference to a " \
|
@@ -213,23 +213,23 @@ module FixtureFox
|
|
213
213
|
def generate_record_ids
|
214
214
|
# puts "generate_record_ids"
|
215
215
|
# puts " ids: #{@ids}"
|
216
|
-
@
|
216
|
+
@super_table_records = [] # Array of pairs of super_table/id
|
217
217
|
records.each { |ast_record|
|
218
218
|
table = ast_record.type.table
|
219
|
-
table_uid = table.
|
219
|
+
table_uid = table.sub_table? ? table.super_table.uid : table.uid
|
220
220
|
|
221
|
-
# If enclosing record/table is the
|
222
|
-
if table.
|
221
|
+
# If enclosing record/table is the super_table, then take the ID from there
|
222
|
+
if table.sub_table?
|
223
223
|
parent_table = ast_record.parent.type.table
|
224
|
-
if table.
|
224
|
+
if table.super_table == parent_table # works for both Record and Table objects
|
225
225
|
id = @ids[table.uid] = @ids[parent_table.uid]
|
226
226
|
|
227
|
-
# Enclosing record/table is not the
|
228
|
-
# based on the current
|
227
|
+
# Enclosing record/table is not the super_table so generate a new ID
|
228
|
+
# based on the current super_table ID and prepare a new super_table
|
229
229
|
# record
|
230
230
|
else
|
231
|
-
id = @ids[table.uid] = @ids[table.
|
232
|
-
@
|
231
|
+
id = @ids[table.uid] = @ids[table.super_table.uid] += 1
|
232
|
+
@super_table_records << [table.super_table, id]
|
233
233
|
end
|
234
234
|
ast_record.id = id
|
235
235
|
|
@@ -261,8 +261,8 @@ module FixtureFox
|
|
261
261
|
# Build all root tables. This makes sure empty tables are registered
|
262
262
|
ast.tables.each { |t| idr.put(t.schema, t.type.table.name) }
|
263
263
|
|
264
|
-
# Create implicit
|
265
|
-
@
|
264
|
+
# Create implicit super_table records
|
265
|
+
@super_table_records.each { |table, id|
|
266
266
|
idr.put(table.schema.name, table.name, id)
|
267
267
|
}
|
268
268
|
|
data/lib/fixture_fox/version.rb
CHANGED
data/lib/fixture_fox.rb
CHANGED
@@ -83,7 +83,7 @@ module FixtureFox
|
|
83
83
|
def initialize(type, files = [], schema: nil, ids: nil, anchors: nil)
|
84
84
|
constrain type, PgGraph::Type
|
85
85
|
constrain files, [String]
|
86
|
-
constrain ids,
|
86
|
+
constrain ids, { String => Integer }, nil
|
87
87
|
constrain anchors, Anchors, [Hash], NilClass
|
88
88
|
@type = type
|
89
89
|
@files = []
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fixture_fox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
248
|
- !ruby/object:Gem::Version
|
249
249
|
version: '0'
|
250
250
|
requirements: []
|
251
|
-
rubygems_version: 3.3.
|
251
|
+
rubygems_version: 3.3.18
|
252
252
|
signing_key:
|
253
253
|
specification_version: 4
|
254
254
|
summary: fixture_fox gem
|