dxlite 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/lib/dxlite.rb +37 -30
  4. data.tar.gz.sig +0 -0
  5. metadata +12 -12
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a826f1bbdc7b1560d8a66ff303a87a1cf3a789cf0281b1aa8130ce0cdaf4893e
4
- data.tar.gz: e4e5401e812f9b69def5f87f6cd2178292c7fb58d604bf6a091da1a8d634ea64
3
+ metadata.gz: 26b439376d323ebf252c80b4beb705a078b4aafae6a8c454eade112ff2bafef1
4
+ data.tar.gz: 89a361d248390fed5cd385f2cb1ff9025dbd6e13df64b05413eab830eef0e454
5
5
  SHA512:
6
- metadata.gz: fc84a8ef5723964235e215ceaad244725dc882917a4475da3b5f8ca702aacf375b0d8bd8536fe297580a5a8be321367867332a3aff2839636ccb0113beaf8cba
7
- data.tar.gz: 21daf4162a732639f0b8c5c0b41f9e09edf552db9a55aa632a8c0f082273074b54b2a588bab166804fc9079452340a0956baf98a790abaa1214553e85b16eeb5
6
+ metadata.gz: 8348c12d469466b5915a9178e7fb15076bd2345768e4440a6ce99d1fee79ec1423754d65e922c03dac6f4a875ecb16dd23f7e3a477d73e4c1adb30b16f98a127
7
+ data.tar.gz: 57a73d0c80ea752eb8f79dbb99e04bb757ffa48fd0c389c48402a9387905f67a6fab637ea9e1074e9e53d09eb2c5902ca168c279297216bb6e78cebc0ea2a373
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/dxlite.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  # file: dxlite.rb
4
4
 
5
5
  require 'c32'
6
+ require 'kvx'
6
7
  require 'json'
7
8
  require 'recordx'
8
9
  require 'rxfhelper'
@@ -11,8 +12,8 @@ require 'rxfhelper'
11
12
  class DxLite
12
13
  using ColouredText
13
14
 
14
- attr_accessor :summary, :filepath, :schema
15
- attr_reader :records
15
+ attr_accessor :summary, :filepath
16
+ attr_reader :records, :schema
16
17
 
17
18
  def initialize(s=nil, autosave: false, debug: false)
18
19
 
@@ -40,8 +41,7 @@ class DxLite
40
41
 
41
42
  when :text
42
43
 
43
- @summary = {schema: s}
44
-
44
+ new_summary(s)
45
45
 
46
46
  when :url
47
47
 
@@ -49,29 +49,6 @@ class DxLite
49
49
 
50
50
  end
51
51
 
52
- puts '@summary: ' + @summary.inspect if @debug
53
- @schema = @summary[:schema]
54
-
55
- summary_attributes = {
56
- recordx_type: 'dynarex',
57
- default_key: @schema[/(?<=\()\w+/]
58
- }
59
-
60
- puts 'before merge' if @debug
61
- @summary.merge!(summary_attributes)
62
-
63
- summary = @summary[:schema][/(?<=\[)[^\]]+/]
64
-
65
- if summary then
66
-
67
- summary.split(/ *, */).each do |x|
68
- @summary[x] = nil unless @summary[x]
69
- end
70
-
71
- end
72
-
73
- make_methods()
74
-
75
52
  end
76
53
 
77
54
  def all()
@@ -155,13 +132,15 @@ class DxLite
155
132
 
156
133
  def parse(obj=nil)
157
134
 
135
+ @records ||= []
136
+
158
137
  if obj.is_a? Array then
159
138
 
160
139
  unless schema() then
161
140
  puts 'obj.first: ' + obj.first.inspect if @debug
162
141
  cols = obj.first.keys.map {|c| c == 'id' ? 'uid' : c}
163
142
  puts 'after cols' if @debug
164
- self.schema = "items/item(%s)" % cols.join(', ')
143
+ new_summary "items/item(%s)" % cols.join(', ')
165
144
  end
166
145
 
167
146
  obj.each do |x|
@@ -189,10 +168,10 @@ class DxLite
189
168
  summary[:schema] = summary['schema']
190
169
  %w(recordx_type format_mask schema).each {|x| summary.delete x}
191
170
 
192
- schema = summary[:schema]
171
+ @schema = summary[:schema]
193
172
  puts 'schema: ' + schema.inspect if @debug
194
173
 
195
- @fields = schema[/\(([^\)]+)/,1].split(/ *, +/)
174
+ @fields = @schema[/\(([^\)]+)/,1].split(/ *, +/)
196
175
  puts 'fields: ' + @fields.inspect if @debug
197
176
 
198
177
  @summary = summary
@@ -335,6 +314,34 @@ class DxLite
335
314
 
336
315
  end
337
316
 
317
+ def new_summary(schema)
318
+
319
+ @summary = {schema: schema}
320
+
321
+ puts '@summary: ' + @summary.inspect if @debug
322
+ @schema = @summary[:schema]
323
+
324
+ summary_attributes = {
325
+ recordx_type: 'dynarex',
326
+ default_key: schema[/(?<=\()\w+/]
327
+ }
328
+
329
+ puts 'before merge' if @debug
330
+ @summary.merge!(summary_attributes)
331
+
332
+ summary = @summary[:schema][/(?<=\[)[^\]]+/]
333
+
334
+ if summary then
335
+
336
+ summary.split(/ *, */).each do |x|
337
+ @summary[x] = nil unless @summary[x]
338
+ end
339
+
340
+ end
341
+
342
+ make_methods()
343
+ end
344
+
338
345
  def read(buffer)
339
346
 
340
347
  if buffer[0] == '<' then
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dxlite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,48 +35,48 @@ cert_chain:
35
35
  9pK+pqislEMFrWscGeMsc6YMS7ALxEujTuwTWyxmWAXnYft4ff2O1Zh2sPmdOlgf
36
36
  camg7d8q+VZZzAtz0cFc4pip
37
37
  -----END CERTIFICATE-----
38
- date: 2021-12-29 00:00:00.000000000 Z
38
+ date: 2022-02-04 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
- name: recordx
41
+ name: kvx
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.5'
46
+ version: '1.0'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 0.5.5
49
+ version: 1.0.1
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '0.5'
56
+ version: '1.0'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 0.5.5
59
+ version: 1.0.1
60
60
  - !ruby/object:Gem::Dependency
61
- name: rxfhelper
61
+ name: recordx
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '1.1'
66
+ version: '0.5'
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 1.1.3
69
+ version: 0.5.5
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '1.1'
76
+ version: '0.5'
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 1.1.3
79
+ version: 0.5.5
80
80
  description:
81
81
  email: digital.robertson@gmail.com
82
82
  executables: []
metadata.gz.sig CHANGED
Binary file