polyrex 0.9.12 → 0.9.13

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: afdf9d69e8ab31c3285880c695ebfb157698ac7f
4
- data.tar.gz: 2b0a96745c0630033d8e22ee376bd0afad23b885
3
+ metadata.gz: 932bd632891aad9d704f28c577f0d74bd87e8086
4
+ data.tar.gz: 6ddd40237513fe41bac1d99d3ea2a14536156dd1
5
5
  SHA512:
6
- metadata.gz: e16d7a48c390f9888cf99925383ef350bf12055a74b3b8a7d5cd7b514e1940b62ec7f436c5df4e743118376b5b4ba01886728edd92edc4cbfc4885088553a40b
7
- data.tar.gz: 01fbf2f47282d7d7c06bccf277e721cc3fa559c9b3b2b865e1e42f19aed87589db538a434bd771654a9321783224b238293595a1c94fb6733cb6b6e55dd58c3c
6
+ metadata.gz: 9a7e3560650802d78f827fcf4777507c2dc437caae1b9d1aab97c85fef1e63fb0a853d791a4c00bbe3cf1f09c5316396a00ae7e40a58e46cbc62d23509651139
7
+ data.tar.gz: 5a7c2cec07f4a06d30c4053b6ae4cffcff9ac5910a0a4c235e459e81ec886d1128f500b5e07888dbae51aa387b870b2e5a7971dd005e76e4736d44ef7ad2056a
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/polyrex.rb CHANGED
@@ -392,13 +392,6 @@ EOF
392
392
 
393
393
  end
394
394
 
395
- if @type == 'checklist' then
396
-
397
- @format_masks[1..-1].each do |fm|
398
- fm.sub!(/\s(\[[^\[]+\]$)/,'999999999\1')
399
- end
400
- end
401
-
402
395
  @summary.format_mask = @format_masks
403
396
 
404
397
  records = @parent_node.root
@@ -423,9 +416,29 @@ EOF
423
416
  end
424
417
 
425
418
  def format_line!(a, i=0)
426
-
419
+
427
420
  records = Rexle::Element.new('records')
421
+
422
+ # add code here for rowx
423
+ @field_names = format_masks[i].to_s.scan(/\[!(\w+)\]/)\
424
+ .flatten.map(&:to_sym)
428
425
 
426
+ rowx_fields = a.map{|x| x.first[/^\w+(?=:)/].to_s.to_sym}.uniq
427
+
428
+ records = if (@field_names & rowx_fields).length >= 2 then
429
+ # rowx implementation still to-do
430
+ #vertical_fiedlparse(records, a, i)
431
+ else
432
+ horizontal_fieldparse(records, a, i)
433
+ end
434
+
435
+ end
436
+
437
+
438
+ # -- end of full text edit methods
439
+
440
+ def horizontal_fieldparse(records, a, i)
441
+
429
442
  a.each do |x|
430
443
 
431
444
  unless @recordx[i] then
@@ -436,19 +449,9 @@ EOF
436
449
  tag_name = @recordx[i].to_s
437
450
  line = raw_line = x.shift
438
451
 
439
- if @type == 'checklist' then
440
452
 
441
- raw_checked, line = raw_line.partition(/\]/).values_at 0,2
442
-
443
- if raw_checked.lstrip[/^\[/] then
444
- checkmark = raw_checked[/x/] ? true : false
445
- else
446
- checkmark = nil
447
- line = raw_line
448
- end
449
- else
450
- line = raw_line
451
- end
453
+ line = raw_line
454
+
452
455
 
453
456
  if line[/\w+\s*---/] then
454
457
 
@@ -459,6 +462,7 @@ EOF
459
462
  next
460
463
  end
461
464
 
465
+
462
466
  unless @format_masks[i][/^\(.*\)$/] then
463
467
 
464
468
  @field_names, field_values = RXRawLineParser.new(format_masks[i])\
@@ -487,10 +491,7 @@ EOF
487
491
 
488
492
  record.add_attribute(id: @id_counter.clone)
489
493
  summary = Rexle::Element.new('summary')
490
-
491
- if @type == 'checklist' then
492
- field_values[-1] = checkmark.to_s unless checkmark.nil?
493
- end
494
+
494
495
 
495
496
  @field_names.zip(field_values).each do |name, value|
496
497
  field = Rexle::Element.new(name.to_s)
@@ -500,10 +501,6 @@ EOF
500
501
 
501
502
  format_mask = @format_masks[i]
502
503
 
503
- if @type == 'checklist' then
504
- format_mask = format_mask.sub(/999999999/,' ')
505
- end
506
-
507
504
  schema = "%s[%s]" % [tag_name, @field_names.join(', ')]
508
505
  summary.add Rexle::Element.new('format_mask').add_text(format_mask)
509
506
  summary.add Rexle::Element.new('schema').add_text(schema)
@@ -515,11 +512,9 @@ EOF
515
512
  record.add child_records
516
513
  records.add record
517
514
  end
518
-
515
+
519
516
  records
520
517
  end
521
-
522
- # -- end of full text edit methods
523
518
 
524
519
  def attach_create_handlers(names)
525
520
  methodx = names.map do |name|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyrex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.12
4
+ version: 0.9.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  wbQnaFmJMPFyXo9Yh/95QJEinnBsM0Yk8nJhmcChjdCpQL5243BjgzVEjHI1Ouxe
32
32
  SmUIljyExpxiHQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2014-10-02 00:00:00.000000000 Z
34
+ date: 2014-12-27 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: polyrex-schema
metadata.gz.sig CHANGED
Binary file