dynarex 1.2.12 → 1.2.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/dynarex.rb +16 -16
  2. metadata +2 -2
@@ -18,7 +18,7 @@ class Dynarex
18
18
 
19
19
  attr_accessor :format_mask, :delimiter, :xslt_schema, :schema, :order
20
20
 
21
- def self.gem_url() 'http://www.jamesrobertson.eu/ruby/dynarex#1.2,12' end
21
+ def self.gem_url() 'http://www.jamesrobertson.eu/ruby/dynarex#1.2.13' end
22
22
 
23
23
  #Create a new dynarex document from 1 of the following options:
24
24
  #* a local file path
@@ -427,26 +427,13 @@ EOF
427
427
  i = @doc.root.xpath('max(records/*/attribute::id)').to_i
428
428
 
429
429
  raw_summary = schema[/\[([^\]]+)/,1]
430
- rowx = buffer[/--\+.*/m]
430
+ #rowx = buffer[/--\+.*/m]
431
431
 
432
- buffer = rowx if rowx
432
+ #buffer = rowx if rowx
433
433
 
434
434
  raw_lines = buffer.gsub(/^\s*#[^\n]+/,'').gsub(/\n\n/,"\n")\
435
435
  .strip.split(/\r?\n|\r(?!\n)/)
436
436
 
437
- if @order == 'descending' then
438
- rl = raw_lines
439
-
440
- if rowx then
441
- raw_lines = [rl[0]] + rl[1..-1].each_slice(@fields.count).inject([])\
442
- {|r,x| r += x.reverse }.reverse
443
- else
444
- raw_lines = rl.each_slice(@fields.count).inject([])\
445
- {|r,x| r += x.reverse }.reverse
446
- end
447
-
448
- end
449
-
450
437
  if raw_summary then
451
438
  a_summary = raw_summary.split(',').map(&:strip)
452
439
 
@@ -458,6 +445,19 @@ EOF
458
445
  @summary[label] = val
459
446
  end
460
447
  end
448
+
449
+ if @order == 'descending' then
450
+ rl = raw_lines
451
+
452
+ if rl.first =~ /--/ then
453
+ raw_lines = [rl[0]] + rl[1..-1].each_slice(@fields.count).inject([])\
454
+ {|r,x| r += x.reverse }.reverse
455
+ else
456
+ raw_lines = rl.each_slice(@fields.count).inject([])\
457
+ {|r,x| r += x.reverse }.reverse
458
+ end
459
+
460
+ end
461
461
 
462
462
  @summary[:recordx_type] = 'dynarex'
463
463
  @summary[:schema] = @schema
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dynarex
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.2.12
5
+ version: 1.2.13
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Robertson
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2013-01-05 00:00:00 Z
13
+ date: 2013-01-06 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rexle