dynarex 1.2.30 → 1.2.31

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: 0de448fafe96222ba235d6c638c052f0515b7760
4
- data.tar.gz: 3132eef76aef292878e86f2217f2f8dda6a57760
3
+ metadata.gz: 43ead0947536928464dc4dfce435aa84de0d3544
4
+ data.tar.gz: b0780ccfa393fa0ffd377b14eb602fd68b7d717e
5
5
  SHA512:
6
- metadata.gz: 6a15bae8efbb93ce779f06555b23902c8190a4ee0a0ad12936ce26310201499c4ddea8f1d5f34cb19dd0aeaa3a8d157cecbc215dc972053e01bd360f6d2577f1
7
- data.tar.gz: ee7540110279a67ae79fc5f558b6af410dc7e4e7b4804f569c6e8770aa7ac7dab23397aee3cf9d717a3ebf06fba6c87b0c0269c4bbc0c4315a3c43c4f4b83265
6
+ metadata.gz: 2554422e1cafdd9666cf384c436c724a82636866995bd77631b535b67397a58811b3d56df68c8757d1db64c2201f8844f95ff07fde2183a71cc8cac2918b236f
7
+ data.tar.gz: 4b80172746018dea4fd8611b19f1d868736391076fe162e3a2b7f52f0e347ec2980a0bcdb17bf6523588c2440896772d5d5538e92bbf9d5ac078980857c332f5
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -403,6 +403,11 @@ EOF
403
403
 
404
404
  private
405
405
 
406
+ def add_id(a)
407
+ @default_key = :id
408
+ @fields << :id
409
+ a.each.with_index{|x,i| x << (i+1).to_s}
410
+ end
406
411
 
407
412
  def create_find(fields)
408
413
 
@@ -582,16 +587,23 @@ EOF
582
587
  line << field.to_s + ':' if line.grep(/^#{field.to_s}:/).empty?
583
588
  end
584
589
  end
585
-
586
- xml = RowX.new(populated_lines.join("\n")).to_xml
587
590
 
591
+ xml = RowX.new(populated_lines.map{|x| x.join("\n")}.join("\n\n")).to_xml
588
592
  a2 = Rexle.new(xml).root.xpath('item').inject([]) do |r,x|
589
593
  r << @fields.map {|field| x.text(field.to_s) }
590
594
  end
595
+
596
+ # if there is no field value for the first field then
597
+ # the default_key is invalid. The default_key is changed to an ID.
598
+ if a2.detect {|x| x.first == ''} then
599
+ add_id(a2)
600
+ end
601
+
602
+ a2
591
603
 
592
604
  else
593
605
 
594
- raw_lines.map.with_index do |x,i|
606
+ a2 = raw_lines.map.with_index do |x,i|
595
607
 
596
608
  begin
597
609
  field_names, field_values = RXRawLineParser.new(@format_mask).parse(x)
@@ -601,6 +613,9 @@ EOF
601
613
  field_values
602
614
  end
603
615
 
616
+ a3 = a2.map(&:first)
617
+ add_id(a2) if a3 != a3.uniq
618
+ a2
604
619
  end
605
620
 
606
621
  a = lines.map.with_index do |x,i|
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.2.30
4
+ version: 1.2.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -29,7 +29,7 @@ cert_chain:
29
29
  kUea9jZD+xTq1Js9t2BHCz3Ev/sgS7CaijrbQetbNwzasFGHRd30xBEwd4zANQOp
30
30
  i0OBH0e4iIMkv+Q+PYlNRnlpQogsAdTs
31
31
  -----END CERTIFICATE-----
32
- date: 2013-08-06 00:00:00.000000000 Z
32
+ date: 2013-08-07 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rexle
metadata.gz.sig CHANGED
Binary file