dynarex 1.2.39 → 1.2.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/dynarex.rb +9 -7
- metadata +1 -1
- 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: 77fcce15dd115120b200511802c9120151ba05f1
|
|
4
|
+
data.tar.gz: d6af745ecd930d7dfd65a6df69c1a53c18b4ad7a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c9c5b06973720ae3b787fc1a9b036bb2ad52a00af2a7e61cfe2cb9cc8b8c62ed3395276f5781d30ae0edf0cf70311d1e6a8a4f1c61d685d4c70ef6c28c0c4135
|
|
7
|
+
data.tar.gz: 4073fde1dc5e56cdcffb3e4f82ffd155c92d51ced0cd761e0bd791209bfb9a58901486d14bb10aaa288552f3f3d260119399101a0317a7b60264c7fda7e29b9d
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/lib/dynarex.rb
CHANGED
|
@@ -321,7 +321,6 @@ EOF
|
|
|
321
321
|
a = xml.send @root_name do
|
|
322
322
|
xml.summary do
|
|
323
323
|
@summary.each{|key,value| xml.send key, value}
|
|
324
|
-
xml.send 'default_key', @default_key.to_s unless @summary['default_key']
|
|
325
324
|
end
|
|
326
325
|
if @records then
|
|
327
326
|
xml.records do
|
|
@@ -406,6 +405,7 @@ EOF
|
|
|
406
405
|
|
|
407
406
|
def add_id(a)
|
|
408
407
|
@default_key = :id
|
|
408
|
+
@summary[:default_key] = 'id'
|
|
409
409
|
@fields << :id
|
|
410
410
|
a.each.with_index{|x,i| x << (i+1).to_s}
|
|
411
411
|
end
|
|
@@ -512,7 +512,7 @@ EOF
|
|
|
512
512
|
|
|
513
513
|
@summary = {}
|
|
514
514
|
raw_lines.shift while raw_lines.first.strip.empty?
|
|
515
|
-
|
|
515
|
+
|
|
516
516
|
# fetch any summary lines
|
|
517
517
|
while not raw_lines.empty? and \
|
|
518
518
|
raw_lines.first[/#{a_summary.join('|')}:\s+[\w\*\-\+]+/] do
|
|
@@ -721,6 +721,7 @@ EOF
|
|
|
721
721
|
@format_mask = @doc.root.element('summary/format_mask/text()')
|
|
722
722
|
|
|
723
723
|
@fields = @format_mask.to_s.scan(/\[!(\w+)\]/).flatten.map(&:to_sym) if @format_mask
|
|
724
|
+
@fields << @default_key if @default_key
|
|
724
725
|
|
|
725
726
|
if @schema and @schema.match(/(\w+)\(([^\)]+)/) then
|
|
726
727
|
@record_name, raw_fields = @schema.match(/(\w+)\(([^\)]+)/).captures
|
|
@@ -728,15 +729,17 @@ EOF
|
|
|
728
729
|
end
|
|
729
730
|
|
|
730
731
|
if @fields then
|
|
732
|
+
|
|
731
733
|
@default_key = @fields[0] unless @default_key
|
|
732
734
|
# load the record query handler methods
|
|
733
735
|
attach_record_methods
|
|
734
736
|
else
|
|
735
737
|
|
|
736
738
|
#jr080912 @default_key = @doc.root.xpath('records/*/*').first.name
|
|
737
|
-
|
|
738
739
|
@default_key = @doc.root.element('records/./.[1]').name
|
|
739
740
|
end
|
|
741
|
+
|
|
742
|
+
@summary[:default_key] = @default_key.to_s
|
|
740
743
|
|
|
741
744
|
if @doc.root.xpath('records/*').length > 0 then
|
|
742
745
|
@record_name = @doc.root.element('records/*[1]').name
|
|
@@ -766,8 +769,7 @@ EOF
|
|
|
766
769
|
def records_to_h()
|
|
767
770
|
|
|
768
771
|
i = @doc.root.xpath('max(records/*/attribute::id)') || 0
|
|
769
|
-
fields = @doc.root.text('summary/schema')[/\(.*\)/].scan(/\w+/)
|
|
770
|
-
fields << @default_key unless fields.include? @default_key
|
|
772
|
+
#jr090813 fields = @doc.root.text('summary/schema')[/\(.*\)/].scan(/\w+/)
|
|
771
773
|
|
|
772
774
|
@doc.root.xpath('records/*').inject({}) do |result,row|
|
|
773
775
|
|
|
@@ -783,9 +785,9 @@ EOF
|
|
|
783
785
|
created = row.attributes[:created] if row.attributes[:created]
|
|
784
786
|
last_modified = row.attributes[:last_modified] if row.attributes[:last_modified]
|
|
785
787
|
|
|
786
|
-
body = fields.inject({}) do |r,field|
|
|
788
|
+
body = @fields.inject({}) do |r,field|
|
|
787
789
|
|
|
788
|
-
node = row.element field
|
|
790
|
+
node = row.element field.to_s
|
|
789
791
|
|
|
790
792
|
if node then
|
|
791
793
|
text = node.text.unescape
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|