dynarex 1.5.18 → 1.5.19

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: 73fd9467bb98a27d03b5509cf2d4bcfa1a0f0f96
4
- data.tar.gz: 8814042d4df5443adc0ed128dfe95d1f8264459a
3
+ metadata.gz: 5412b392093ede04ff5061ae7c4e97a82a1b3c93
4
+ data.tar.gz: d8e04e710ae9180f73905598facdedd7c94bdf08
5
5
  SHA512:
6
- metadata.gz: d1d796de08476c645b5f053c5f64bec2de50897b38a0a3509f690e62a114f9cb65ba8bb52b7a51f83766abc867487c59080d1bb00425bfbb4a555375be4ba569
7
- data.tar.gz: e33d5a6bee3de8e32dcc67a62a9bcc106f6b4f290d463936e54dd607ad3455460e0c4ecd24e424383743deb94b0b2fbf2defbe759636492e7be21eb6e9f2e2b1
6
+ metadata.gz: 7cfd1f2b63e4dae8648703147b5947729652710b74cbb22cc7ea21af7e87b88c04f6cdf74c3290ef76aed0e34057cd4b74fd6d6292ac782ca148ef7daba08dca
7
+ data.tar.gz: 22828e1113885ed6eb297095f9d93b301feeba8f98445222b66b5ccc366bd9625189a4106eb8baf24d4a32e20db91cf2654cad45708dd59d18058f9cfe6cb5cd
Binary file
data.tar.gz.sig CHANGED
@@ -1,3 +1 @@
1
- ��$�ߣB^�Ut~�aGD��e��G9���vB��c
2
- Q�
3
- ~P9�mAi�"��*��
1
+ � ������n�������9�4�������~͕��wyJYa6��s��6w����0���e��1bM����<Ev �a�MTWae��M���F�(
@@ -311,14 +311,13 @@ EOF
311
311
  #Parses 1 or more lines of text to create or update existing records.
312
312
 
313
313
  def parse(x=nil)
314
- #log = Logger.new('/home/james/mm.log')
315
- #log.debug('dynarex: inside parse()')
314
+
316
315
  raw_buffer, type = RXFHelper.read(x)
317
316
 
318
317
  if raw_buffer.is_a? String then
319
318
  buffer = raw_buffer.clone
320
319
  buffer = yield if block_given?
321
- #log.debug('dynarex: before string_parse()')
320
+
322
321
  string_parse buffer
323
322
  else
324
323
  foreign_import x
@@ -450,9 +449,14 @@ EOF
450
449
  xml.records do
451
450
 
452
451
  records.each do |k, item|
453
-
454
- xml.send(@record_name, {id: item[:id], created: item[:created], \
455
- last_modified: item[:last_modified]}, '') do
452
+
453
+ attributes = {}
454
+
455
+ item.keys.each do |key|
456
+ attributes[key] = item[key] || '' unless key == :body
457
+ end
458
+
459
+ xml.send(@record_name, attributes) do
456
460
  item[:body].each do |name,value|
457
461
 
458
462
  name = ('._' + name.to_s).to_sym if reserved_keywords.include? name
@@ -862,7 +866,7 @@ EOF
862
866
  @default_key = default_key if default_key
863
867
 
864
868
  ptrn = %r((\w+)\[?([^\]]+)?\]?\/(\w+)\(([^\)]+)\))
865
- #@log.debug 'inside dynarex_new'
869
+
866
870
  if s.match(ptrn) then
867
871
  @root_name, raw_summary, record_name, raw_fields = s.match(ptrn).captures
868
872
  summary, fields = [raw_summary || '',raw_fields].map {|x| x.split(/,/).map &:strip}
@@ -879,13 +883,13 @@ EOF
879
883
  end
880
884
 
881
885
  format_mask = fields ? fields.map {|x| "[!%s]" % x}.join(' ') : ''
882
- #@log.debug 'dynarex_new: before @summary'
886
+
883
887
  @summary = Hash[summary.zip([''] * summary.length).flatten.each_slice(2)\
884
888
  .map{|x1,x2| [x1.to_sym,x2]}]
885
889
  @summary.merge!({recordx_type: 'dynarex', format_mask: format_mask, schema: s})
886
890
  @records = {}
887
891
  @flat_records = {}
888
- #@log.debug 'dynarex_new: before rebuild_doc'
892
+
889
893
  rebuild_doc
890
894
 
891
895
  end
@@ -1008,12 +1012,12 @@ EOF
1008
1012
  puts @doc.to_s
1009
1013
  end
1010
1014
 
1011
- def records_to_h(state=:ascending)
1015
+ def records_to_h(order=:ascending)
1012
1016
 
1013
1017
  i = @doc.root.xpath('max(records/*/attribute::id)') || 0
1014
1018
  records = @doc.root.xpath('records/*')
1015
1019
 
1016
- recs = records #jr160315 (state == :descending ? records.reverse : records)
1020
+ recs = records #jr160315 (order == :descending ? records.reverse : records)
1017
1021
  a = recs.inject({}) do |result,row|
1018
1022
 
1019
1023
  created = Time.now.to_s
@@ -1025,9 +1029,6 @@ EOF
1025
1029
  i += 1; id = i.to_s
1026
1030
  end
1027
1031
 
1028
- created = row.attributes[:created] if row.attributes[:created]
1029
- last_modified = row.attributes[:last_modified] if row.attributes[:last_modified]
1030
-
1031
1032
  body = (@fields - ['uid']).inject({}) do |r,field|
1032
1033
 
1033
1034
  node = row.element field.to_s
@@ -1043,7 +1044,8 @@ EOF
1043
1044
 
1044
1045
  body[:uid] = id if @default_key == 'uid'
1045
1046
 
1046
- result.merge body[@default_key.to_sym] => {id: id, created: created, last_modified: last_modified, body: body}
1047
+ attributes = row.attributes
1048
+ result.merge body[@default_key.to_sym] => attributes.merge({id: id, body: body})
1047
1049
  end
1048
1050
 
1049
1051
  end
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.5.18
4
+ version: 1.5.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  zafTuKRozNy5wCw7Z32VaDGcJ+yTPq73CrcPrNyaoxqGfU0qNsh6oGvwrq4Q1k4j
32
32
  Pz2GWE7KigXTBg==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-04-11 00:00:00.000000000 Z
34
+ date: 2015-04-12 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dynarex-import
metadata.gz.sig CHANGED
Binary file