dynarex 1.8.11 → 1.8.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f5ae78fd570290f8d09b95ee966145ae9d1e6ea5e2a09389e148fd03de63fe9
4
- data.tar.gz: 9b6819de911fab5f1a87659204a26af3b6c92bfbc1c89d0b82906ba34e8d6b6f
3
+ metadata.gz: e190bb819e928a82ee758b9c01a07fd06168088dd9b8d7ab6c0f60d6586d3809
4
+ data.tar.gz: 3da35d504531ddd6436821e129473b122645b5cc3bf928aebe67e23877472d62
5
5
  SHA512:
6
- metadata.gz: a03a19cd607a1c2dc511f55e46e06919fa8900dae2c167d8867280823800182621dff109aafe4f8ed854600119de2e80ba74f4fe8fe30a59781e8fb281ced692
7
- data.tar.gz: 268ba21508f2654163b2f2a7e765c6dcacf1d46bbed243a888e7b74896cf7fc5c26b43f7400465ce7c27fd7c53b86dc83f9f3e8eba3f2c9a5a57eeb8035fe6dc
6
+ metadata.gz: 43042f3593485b6991af830cc98fddc44f283789d30e7365af132a7737f3548bb876564606536ee2b5aa4e0463d3dd50dd92c3559356ec942047f97d3af9e6c3
7
+ data.tar.gz: daf6d0081f699a528d7290078ebfeaa6ae6af391e9dd6e99e620e9c00b2e9ac608be2eb3eee99e0fd20a4c8fcf29cd6d4efe04e23bfc4af2f256f79f96fbf215
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -72,7 +72,7 @@ class Dynarex
72
72
  using ColouredText
73
73
 
74
74
  attr_accessor :format_mask, :delimiter, :xslt_schema, :schema, :linked,
75
- :order, :type, :limit, :xslt, :json_out
75
+ :order, :type, :limit, :xslt, :json_out, :unique
76
76
 
77
77
 
78
78
  #Create a new dynarex document from 1 of the following options:
@@ -85,13 +85,14 @@ class Dynarex
85
85
 
86
86
  def initialize(rawx=nil, username: nil, password: nil, schema: nil,
87
87
  default_key: nil, json_out: true, debug: false,
88
- delimiter: ' # ', autosave: false, order: 'ascending')
88
+ delimiter: ' # ', autosave: false, order: 'ascending',
89
+ unique: false)
89
90
 
90
91
 
91
92
  puts 'inside Dynarex::initialize' if debug
92
- @username, @password, @schema, @default_key, @json_out, @debug = username,
93
- password, schema, default_key, json_out, debug
94
- @autosave = autosave
93
+ @username, @password, @schema, @default_key, @json_out, @debug = \
94
+ username, password, schema, default_key, json_out, debug
95
+ @autosave, @unique = autosave, unique
95
96
 
96
97
  puts ('@debug: ' + @debug.inspect).debug if debug
97
98
  @delimiter = delimiter
@@ -731,6 +732,12 @@ EOF
731
732
  xml
732
733
  end
733
734
 
735
+ def unique=(bool)
736
+ self.summary.merge!({unique: bool})
737
+ @dirty_flag = true
738
+ @unique = bool
739
+ end
740
+
734
741
  def xpath(x)
735
742
  @doc.root.xpath x
736
743
  end
@@ -1011,6 +1018,7 @@ EOF
1011
1018
  @summary[:recordx_type] = 'dynarex'
1012
1019
  @summary[:schema] = @schema
1013
1020
  @summary[:format_mask] = @format_mask
1021
+ @summary[:unique] = @unique
1014
1022
 
1015
1023
  raw_lines.shift while raw_lines.first.strip.empty?
1016
1024
 
@@ -1070,7 +1078,17 @@ EOF
1070
1078
 
1071
1079
  a2.compact!
1072
1080
  a3 = a2.compact.map(&:first)
1073
- add_id(a2) if a3 != a3.uniq
1081
+
1082
+ if a3 != a3.uniq then
1083
+
1084
+ if @unique then
1085
+ raise DynarexException, "Duplicate id found"
1086
+ else
1087
+ add_id(a2)
1088
+ end
1089
+
1090
+ end
1091
+
1074
1092
  a2
1075
1093
  end
1076
1094
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynarex
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.11
4
+ version: 1.8.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -30,7 +30,7 @@ cert_chain:
30
30
  +2pKHQJfU1lEmVoo4afsLMvmq/CZPJba1LR3Z1QJXYCWt9IEZTECStKlK7H6RiIx
31
31
  gRA=
32
32
  -----END CERTIFICATE-----
33
- date: 2019-01-03 00:00:00.000000000 Z
33
+ date: 2019-01-07 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: dynarex-import
metadata.gz.sig CHANGED
Binary file