dynarex 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dynarex.rb +3 -3
- metadata +1 -1
data/lib/dynarex.rb
CHANGED
@@ -88,11 +88,11 @@ EOF
|
|
88
88
|
i = XPath.match(@doc.root, 'records/*/attribute::id').max_by(&:value).to_s.to_i
|
89
89
|
t = @format_mask.to_s.gsub(/\[!(\w+)\]/, '(.*)').sub(/\[/,'\[').sub(/\]/,'\]')
|
90
90
|
lines = buffer.split(/\r?\n|\r(?!\n)/).map {|x|x.match(/#{t}/).captures}
|
91
|
-
|
91
|
+
fields = @format_mask.scan(/\[!(\w+)\]/).flatten.map(&:to_sym)
|
92
92
|
a = lines.map do|x|
|
93
93
|
created = Time.now.to_s
|
94
94
|
|
95
|
-
h = Hash[
|
95
|
+
h = Hash[fields.zip(x)]
|
96
96
|
[h[@default_key.to_s], {id: '', created: created, last_modified: '', body: h}]
|
97
97
|
end
|
98
98
|
|
@@ -276,7 +276,7 @@ end))
|
|
276
276
|
@default_key = XPath.first(@doc.root, 'summary/default_key/text()')
|
277
277
|
@format_mask = XPath.first(@doc.root, 'summary/format_mask/text()')
|
278
278
|
|
279
|
-
|
279
|
+
#@fields = @format_mask.to_s.scan(/\[!(\w+)\]/).flatten.map(&:to_sym) if @format_mask
|
280
280
|
|
281
281
|
if @schema then
|
282
282
|
@record_name, raw_fields = @schema.match(/(\w+)\(([^\)]+)/).captures
|