polyrex 0.9.6 → 0.9.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6a00caeddc8093f0ec2c7512ed4c4764bb664c2
4
- data.tar.gz: aadcacc4b2a4383c9e74652e4bd12cefd56584bc
3
+ metadata.gz: 9e35802a9693f4b39bf1059cf88b5d2a255adb93
4
+ data.tar.gz: 65da0762a7bfae0ef61513e65a38ff2cb1e719c0
5
5
  SHA512:
6
- metadata.gz: fab152a568e1a47194c6675c094fadafb70531d81e973de01afa5e0fbc396aba7eda2453765fa97a14ea1b7cee348608610efdbf45574fb078a1d6d6f3b3c5da
7
- data.tar.gz: cbc6be2f1e3f1a125cf0353cc78b5f7dd90d867256e7c463434d63b1c87a250901497dcf3353e4d67dcf060591f58b6287ba2b59ef4276056716d6f161cfa62f
6
+ metadata.gz: 10e6f734c8018595e2d84c25406ae97862ff7b32f96628f493ab5688215d346501955f8130505cccc4ed271121e2d6ca6148c510973f65ab01ca0077561ec116
7
+ data.tar.gz: 07e294081c17e55bac3e6a7e2e6f5fefc762171f21f13eb8740b9f85d4925538eba74a4348f2eada1b28fdb92235176ac940e96296d86af1f1052eec1f838fb1
@@ -1,3 +1 @@
1
- {{
2
- �1�ރ�k��f_,�5�e~:-#���R��� j���_]
3
- f��r��p!�$����@�#ֱӞm��òJ�3Lf\��ӗ��Uݦ�H{���|�[4�ي���A�����t�%��S�z�+ j�����N�~���0�X�f� R�N�N5�S���곓/���r��$a�Ӟ��$`x�+G� i}� �"�_�>(���1� ��'���Ķqp?�_4q�}1��T�E��c��t�]aK��|��NM��~c
1
+ Y[#���Z9ȪA��,�=uL�)�@�\��!۶~��H'��Q���*��Z�mڥU5'?����B�o֠Z��5@x��˜6���K���D�b�%�8!Ȼ�0�d��<��� ���̂z*�J 9�1�xǦ��E�k����_+ZI��ٛ��h���C�Y��*f�*M%nS<H|�z��$xK�*ݫ�F'����I�.�q�A��N���€�vS��q�k�ߥ��ok��*��Z�@-x�I�v��"�?
data.tar.gz.sig CHANGED
Binary file
@@ -38,7 +38,7 @@ end
38
38
 
39
39
  class Polyrex
40
40
  attr_accessor :summary_fields, :xslt_schema, :id_counter,
41
- :schema, :type, :delimiter, :format_mask
41
+ :schema, :type, :delimiter
42
42
 
43
43
  def initialize(location=nil, opt={})
44
44
 
@@ -48,17 +48,23 @@ class Polyrex
48
48
  @delimiter = ''
49
49
 
50
50
  if location then
51
+
51
52
  self.method(:schema=).call(options[:schema]) if options[:schema]
53
+
52
54
  openx(location)
53
55
 
54
56
  if options[:schema] then
57
+
55
58
  fields = @schema[/\/.*/].scan(/\[([^\]]+)/).map \
56
59
  {|x| x.first.split(',').map(&:strip)}
57
60
  refresh_records self.records, fields, 0
61
+
58
62
  end
59
63
 
64
+
60
65
  summary_h = Hash[*@doc.root.xpath("summary/*").map {|x| [x.name, x.text]}.flatten]
61
66
  #@summary = OpenStruct.new summary_h
67
+
62
68
  @summary = RecordX.new summary_h
63
69
  @summary_fields = summary_h.keys.map(&:to_sym)
64
70
  end
@@ -303,13 +309,14 @@ EOF
303
309
 
304
310
  # -- required for the parsing feature
305
311
  doc = PolyrexSchema.new(schema).to_doc
312
+
306
313
  fm = doc.root.xpath('//format_mask/text()')
307
314
  @format_masks = fm.zip(@format_masks).map{|x,y| y || x }
308
315
 
309
316
  schema_rpath = schema.gsub(/\[[^\]]+\]/,'')
310
317
 
311
318
  @recordx = schema_rpath.split('/')
312
-
319
+
313
320
  summary = ''
314
321
  if @format_masks.length == @recordx.length then
315
322
  root_format_mask = @format_masks.shift
@@ -324,8 +331,8 @@ EOF
324
331
  @id_counter = '0'
325
332
 
326
333
  root_name = @recordx.shift
327
-
328
334
  ("<%s><summary>%s</summary><records/></%s>" % [root_name, (summary || '') , root_name])
335
+
329
336
  end
330
337
 
331
338
  def recordx_map(node)
@@ -401,9 +408,10 @@ EOF
401
408
  end
402
409
 
403
410
  def load_handlers(schema)
404
- @create = PolyrexCreateObject.new(schema, @id_counter)
405
411
 
412
+ @create = PolyrexCreateObject.new(schema, @id_counter)
406
413
  objects = PolyrexObjects.new(schema, @id_counter)
414
+
407
415
  @objects = objects.to_h.inject({}){|r,x| r.merge x[0].downcase => x[-1]}
408
416
  @objects_a = objects.to_a
409
417
 
@@ -528,7 +536,7 @@ EOF
528
536
  self.instance_eval(
529
537
  %Q(
530
538
  def #{name.downcase}()
531
- @objects['#{name}'].new(@parent_node, @id)
539
+ @objects['#{name}'].new(@parent_node.element('.'), @id)
532
540
  end
533
541
  ))
534
542
  end
@@ -553,13 +561,13 @@ EOF
553
561
  @doc = Rexle.new buffer
554
562
 
555
563
  schema = @doc.root.text('summary/schema')
556
-
564
+
557
565
  unless @format_masks
558
566
  schema_rpath = schema.gsub(/\[[^\]]+\]/,'')
559
567
  @recordx = schema_rpath.split('/')
560
568
  @recordx.shift
561
569
  end
562
-
570
+
563
571
  id = @doc.root.xpath('max(//@id)')
564
572
  @id_counter = id.to_s.succ if id
565
573
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyrex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  wbQnaFmJMPFyXo9Yh/95QJEinnBsM0Yk8nJhmcChjdCpQL5243BjgzVEjHI1Ouxe
32
32
  SmUIljyExpxiHQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2014-07-16 00:00:00.000000000 Z
34
+ date: 2014-07-20 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: polyrex-schema
metadata.gz.sig CHANGED
Binary file