dynarex 1.2.39 → 1.2.40

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: 5a6f78cf4c90e46cab4d039679b79f2f299633a8
4
- data.tar.gz: be1f78ce17b2247039435f760718d50e61780030
3
+ metadata.gz: 77fcce15dd115120b200511802c9120151ba05f1
4
+ data.tar.gz: d6af745ecd930d7dfd65a6df69c1a53c18b4ad7a
5
5
  SHA512:
6
- metadata.gz: d1639200f0b08215ecac5e607fe9c962b57360dab65d7e67d9fd015f3d63c9efe1f11baaa6c4f0ce0a6e8c2bfa5d7a441f361f414edeb67101d01f1e815b22a6
7
- data.tar.gz: 8369ea00cb73eab347de86f870267a105f02ae9a3220a11c23c08bc4a5c64f69b3cf95f129e5721b725cf8c203ba457acc6220d1d9efa4efdf07f38c23f4cf6a
6
+ metadata.gz: c9c5b06973720ae3b787fc1a9b036bb2ad52a00af2a7e61cfe2cb9cc8b8c62ed3395276f5781d30ae0edf0cf70311d1e6a8a4f1c61d685d4c70ef6c28c0c4135
7
+ data.tar.gz: 4073fde1dc5e56cdcffb3e4f82ffd155c92d51ced0cd761e0bd791209bfb9a58901486d14bb10aaa288552f3f3d260119399101a0317a7b60264c7fda7e29b9d
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynarex
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.39
4
+ version: 1.2.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file