dynarex 1.7.11 → 1.7.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
  SHA1:
3
- metadata.gz: 3a0c8ee998ad72091418f55c8ac96b12b9fb7063
4
- data.tar.gz: 0db28462c4dfe3aef9cbd06fc96bf786684a6b32
3
+ metadata.gz: cf8be329312f960ac9071137b011d0623295ee50
4
+ data.tar.gz: b1d4939cdfc2bc871602aa81efe9a98eaced2eef
5
5
  SHA512:
6
- metadata.gz: bd76528025cf2d2b58131d3dc52453a6b52382206f005d5b1995f69a055d74c24c69d5af4d38bc420f177e05d80a649315d2b80958eb484882e8965ec991745e
7
- data.tar.gz: 1e4c0b0235ce062908229bd395c6e22dcd92b737a1e48c727abc7a838e615dd2c89e8262715c31ad44a86944f859e9d2c76eb2de9394ce02ab5d1328e3d4ac08
6
+ metadata.gz: fb8ea5b406fc64f3c39cb04f8a140c4cbc85e3405b5c5e4ba3c92e4795198bfa0bc64eba66a2a68201f6de98abddd83aca2b69f581dd2bce2d3484d8310c3f64
7
+ data.tar.gz: 91dd2ae03c9dd8d7e4f858198dfecc5314f91f0ffc8f85ebcbf35e4c6fddbcd0abdce5d21e5bd721b51a9c4e56103c38cc5d4572cdd3bb6f6f54757007dbb228
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -24,6 +24,26 @@ class DynarexException < Exception
24
24
  end
25
25
 
26
26
 
27
+ class DynarexRecordset < Array
28
+
29
+ def initialize(a, caller=nil)
30
+ super(a)
31
+ @caller = caller
32
+ end
33
+
34
+ def reject!()
35
+
36
+ a = self.to_a.clone
37
+ a2 = super
38
+ a3 = a - a2
39
+
40
+ @caller.delete a3.map(&:id)
41
+ self
42
+ end
43
+
44
+ end
45
+
46
+
27
47
  class Dynarex
28
48
 
29
49
  attr_accessor :format_mask, :delimiter, :xslt_schema, :schema, :linked,
@@ -62,7 +82,8 @@ class Dynarex
62
82
  end
63
83
 
64
84
  def all()
65
- @doc.root.xpath("records/*").map {|x| recordx_to_record x}
85
+ a = @doc.root.xpath("records/*").map {|x| recordx_to_record x}
86
+ DynarexRecordset.new(a, self)
66
87
  end
67
88
 
68
89
  def clone()
@@ -437,8 +458,14 @@ EOF
437
458
  #Updates a record from an id and a hash containing field name and field value.
438
459
  # dynarex.update 4, name: Jeff, age: 38
439
460
 
440
- def update(id, params={})
461
+ def update(id, obj)
441
462
 
463
+ params = if obj.is_a? Hash then
464
+ obj
465
+ elsif obj.is_a? RecordX
466
+ obj.to_h
467
+ end
468
+
442
469
  fields = capture_fields(params)
443
470
 
444
471
  # for each field update each record field
@@ -457,7 +484,9 @@ EOF
457
484
  #Delete a record.
458
485
  # dyarex.delete 3 # deletes record with id 3
459
486
 
460
- def delete(x)
487
+ def delete(x)
488
+
489
+ return x.each {|id| self.delete id} if x.is_a? Array
461
490
 
462
491
  if x.to_i.to_s == x.to_s and x[/[0-9]/] then
463
492
  @doc.root.delete("records/*[@id='#{x}']")
@@ -493,6 +522,10 @@ EOF
493
522
  !@doc.root.element("records/*[@id='#{id}']").nil?
494
523
  end
495
524
 
525
+ def refresh()
526
+ @dirty_flag = true
527
+ end
528
+
496
529
  # used internally by to_rss()
497
530
  #
498
531
  def rss_xslt(opt={})
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.7.11
4
+ version: 1.7.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -119,20 +119,20 @@ dependencies:
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: '0.4'
122
+ version: '0.5'
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
- version: 0.4.0
125
+ version: 0.5.0
126
126
  type: :runtime
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '0.4'
132
+ version: '0.5'
133
133
  - - ">="
134
134
  - !ruby/object:Gem::Version
135
- version: 0.4.0
135
+ version: 0.5.0
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: rxraw-lineparser
138
138
  requirement: !ruby/object:Gem::Requirement
@@ -179,20 +179,20 @@ dependencies:
179
179
  requirements:
180
180
  - - "~>"
181
181
  - !ruby/object:Gem::Version
182
- version: '0.2'
182
+ version: '0.3'
183
183
  - - ">="
184
184
  - !ruby/object:Gem::Version
185
- version: 0.2.0
185
+ version: 0.3.1
186
186
  type: :runtime
187
187
  prerelease: false
188
188
  version_requirements: !ruby/object:Gem::Requirement
189
189
  requirements:
190
190
  - - "~>"
191
191
  - !ruby/object:Gem::Version
192
- version: '0.2'
192
+ version: '0.3'
193
193
  - - ">="
194
194
  - !ruby/object:Gem::Version
195
- version: 0.2.0
195
+ version: 0.3.1
196
196
  - !ruby/object:Gem::Dependency
197
197
  name: kvx
198
198
  requirement: !ruby/object:Gem::Requirement
@@ -202,7 +202,7 @@ dependencies:
202
202
  version: '0.6'
203
203
  - - ">="
204
204
  - !ruby/object:Gem::Version
205
- version: 0.6.0
205
+ version: 0.6.1
206
206
  type: :runtime
207
207
  prerelease: false
208
208
  version_requirements: !ruby/object:Gem::Requirement
@@ -212,7 +212,7 @@ dependencies:
212
212
  version: '0.6'
213
213
  - - ">="
214
214
  - !ruby/object:Gem::Version
215
- version: 0.6.0
215
+ version: 0.6.1
216
216
  description:
217
217
  email: james@r0bertson.co.uk
218
218
  executables: []
metadata.gz.sig CHANGED
@@ -1,2 +1 @@
1
- PW�꺯}!r��s5.�<`m���,+5��"_�<�kUb`+�J��@JP��b@�v�L���q�dSj�7���h&�3��w�{���\�X5P@�
2
- �iB<����Ø{C� `�����ܹn�a���H�/ �?ւ��-�/��%��H�|+,G��)�h���+@z{qV��s���G~�� %�J���� 3� �)�-˵�f��{Pmp����On���n��L�J���6����`�]�V�^�  �Z
1
+ ~����e��ψ�of@z�����/�(�!Z��oYBwsP>�_�\�X� Vk�h ��;T g���[�Ak��Fd.� Y�H����޻��3+ii �u��G>�3|��`���d��� bC�+�=