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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -3
- data/lib/dynarex.rb +17 -15
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5412b392093ede04ff5061ae7c4e97a82a1b3c93
|
4
|
+
data.tar.gz: d8e04e710ae9180f73905598facdedd7c94bdf08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cfd1f2b63e4dae8648703147b5947729652710b74cbb22cc7ea21af7e87b88c04f6cdf74c3290ef76aed0e34057cd4b74fd6d6292ac782ca148ef7daba08dca
|
7
|
+
data.tar.gz: 22828e1113885ed6eb297095f9d93b301feeba8f98445222b66b5ccc366bd9625189a4106eb8baf24d4a32e20db91cf2654cad45708dd59d18058f9cfe6cb5cd
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
data/lib/dynarex.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
455
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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(
|
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 (
|
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
|
-
|
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.
|
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-
|
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
|