dxlite 0.6.1 → 0.6.2

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: cdef9eda0edd930a2698134328be46b4be487c13f3125e38b30e36e93ca5d22f
4
- data.tar.gz: e44e9f3791b109b90e139ae749defcf7014adbbc21d642fb8aca70cd4378ce4e
3
+ metadata.gz: ceb35ccf99574494fddc04bcff1ca0da8f3e9105ff96663c4127e001e6c0d0f4
4
+ data.tar.gz: cb7d10780d5fe0930c82ef96918662a9bb0cfa7b52b340987e633e4d5a52c531
5
5
  SHA512:
6
- metadata.gz: a8875b822287ebd3037ccf1cff2ecd39dafcc70a6d99f75b35006448503f5624e1f7fd5dc61ccd6e1d909bb7a78331b5c39832dc0d9f3af7a751ea24e4f65fc5
7
- data.tar.gz: d6abb77ad3dcfdddb2aa30449204286e2be4f7db49f0425380b8d8384212c58fcff9afc3af25f1b45c986c48471be91517bb8958a2a7e1fd49d32dc85dcd7f80
6
+ metadata.gz: 6cc80cf0885f8973443fd2301cbaf9a1f85eb65c47600feb3cf33097ccdc2953a7f0dc9dfd670b80f38255088d2a643bcff2bb80e55b8e179bb20fafc89e5214
7
+ data.tar.gz: f75f94e5af4dbdc3277f698915661d6028b9f04cda8c17f8626767586b69139febfd30cdcb3e9fc40528c297b6125a7dea2e81b0385204852fe174748b9c9d23
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/dxlite.rb CHANGED
@@ -25,7 +25,7 @@ class DxLite
25
25
  attr_accessor :summary, :filepath
26
26
  attr_reader :records, :schema
27
27
 
28
- def initialize(s=nil, autosave: false, debug: false)
28
+ def initialize(s=nil, autosave: false, order: 'ascending', debug: false)
29
29
 
30
30
  @autosave, @debug = autosave, debug
31
31
 
@@ -51,7 +51,7 @@ class DxLite
51
51
 
52
52
  when :text
53
53
 
54
- new_summary(s)
54
+ new_summary(s, order)
55
55
 
56
56
  when :url
57
57
 
@@ -133,6 +133,17 @@ class DxLite
133
133
  @fields
134
134
  end
135
135
 
136
+ def record(id)
137
+
138
+ h = @records.find {|x| x[:id] == id }
139
+ return unless h
140
+ RecordX.new(h[:body], self, h[:id], h[:created], h[:last_modified])
141
+
142
+ end
143
+
144
+ alias find record
145
+ alias find_by_id record
146
+
136
147
  def inspect()
137
148
  "#<DxLite:%s @debug=%s, @summary=%s, ...>" % [object_id, @debug,
138
149
  @summary.inspect]
@@ -213,11 +224,14 @@ class DxLite
213
224
  root_name = schema()[/^\w+/]
214
225
  record_name = schema()[/(?<=\/)[^\(]+/]
215
226
 
227
+ records = @records.map {|h| {record_name.to_sym => h} }
228
+ records.reverse! if @summary[:order] == 'descending'
229
+
216
230
  h = {
217
231
  root_name.to_sym =>
218
232
  {
219
233
  summary: @summary,
220
- records: @records.map {|h| {record_name.to_sym => h} }
234
+ records: records
221
235
  }
222
236
  }
223
237
 
@@ -324,7 +338,7 @@ class DxLite
324
338
 
325
339
  end
326
340
 
327
- def new_summary(schema)
341
+ def new_summary(schema, order)
328
342
 
329
343
  @summary = {schema: schema}
330
344
 
@@ -333,7 +347,8 @@ class DxLite
333
347
 
334
348
  summary_attributes = {
335
349
  recordx_type: 'dynarex',
336
- default_key: schema[/(?<=\()\w+/]
350
+ default_key: schema[/(?<=\()\w+/],
351
+ order: order
337
352
  }
338
353
 
339
354
  puts 'before merge' if @debug
@@ -369,7 +384,8 @@ class DxLite
369
384
 
370
385
  h[:summary].each do |key, value|
371
386
 
372
- if %i(recordx_type format_mask schema default_key).include? key then
387
+ if %i(recordx_type format_mask schema default_key order)\
388
+ .include? key then
373
389
  @summary[key] = value
374
390
  else
375
391
  @summary[key.to_s] = value
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.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  9pK+pqislEMFrWscGeMsc6YMS7ALxEujTuwTWyxmWAXnYft4ff2O1Zh2sPmdOlgf
36
36
  camg7d8q+VZZzAtz0cFc4pip
37
37
  -----END CERTIFICATE-----
38
- date: 2022-03-18 00:00:00.000000000 Z
38
+ date: 2022-03-19 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: recordx
@@ -43,20 +43,20 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.5'
46
+ version: '0.6'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 0.5.5
49
+ version: 0.6.0
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: '0.6'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 0.5.5
59
+ version: 0.6.0
60
60
  description:
61
61
  email: digital.robertson@gmail.com
62
62
  executables: []
metadata.gz.sig CHANGED
Binary file