polyrex-createobject 0.4.13 → 0.4.14

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: fc5ad2ce277f13c8d0e9f4f3f3e9da429802d660
4
- data.tar.gz: 2b91c5a3a4235218abeb004a1b1e9813b834d1de
3
+ metadata.gz: 8f98319d5987ec0fe34bb394d8d7d195e094f321
4
+ data.tar.gz: 1886c4921fea8550d3fb228dcc7fed68450c98dc
5
5
  SHA512:
6
- metadata.gz: 14361d766b144ab719b68a37fe038e3787a873c1dcfeb81d71ccc9ab0c830f0a8136a24965501016a5ab086411501d74cfa6bb77a28c607f1cd1d35992496b26
7
- data.tar.gz: 7b188ca1f86a23668fd832eee7f2eaca6f5bd8a652dde5f3789bdc3f79ff27a20697ec66b604417b42b68f4e4facf4c59e7474602d5a61c0194ee7492f366c0e
6
+ metadata.gz: deaa881b39205cb7b6f490b294d8aa84eb8a0feffe7866799d631a2f4309d410619a0d1d7097bc8d8bbaf552430e75e5c0838d7b0c3e281cc8201f95c2bc0af9
7
+ data.tar.gz: f526f40ed060b1fd0aa81c1b4a3559d1c59a01a3740c5ec6f3a6e36a4977250c372a2c0c6b82f926655ae28b1d76710d34b771800c2d1e9f3e27b8213e44af67
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,10 +1,11 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  # file: polyrex-createobject.rb
4
4
 
5
5
  require 'polyrex-schema'
6
6
  require 'rexle'
7
7
 
8
+
8
9
  class PolyrexCreateObject
9
10
 
10
11
  attr_accessor :parent_node
@@ -13,13 +14,21 @@ class PolyrexCreateObject
13
14
  @@id = id
14
15
 
15
16
  @schema = schema
16
- a = @schema.split('/')
17
17
 
18
- @rpaths = (a.length).times.inject({}) {|r| r.merge ({a.join('/').gsub(/\[[^\]]+\]/,'') => a.pop}) }
19
- names = @rpaths.to_a[0..-2].map {|k,v| [v[/[^\[]+/], k]}
20
-
21
- attach_create_handlers(names)
18
+ if @schema then
19
+ a = @schema.split('/')
20
+ @rpaths = (a.length).times.inject({}) {|r| r.merge ({a.join('/').gsub(/\[[^\]]+\]/,'') => a.pop}) }
22
21
 
22
+ values = @rpaths.values.reverse
23
+
24
+ @rpaths.keys.reverse.each.with_index do |key,i |
25
+ @rpaths[key] = values[i..-1].join('/')
26
+ end
27
+
28
+ names = @rpaths.to_a[0..-2].map {|k,v| [v[/[^\[]+/], k]}
29
+
30
+ attach_create_handlers(names)
31
+ end
23
32
  end
24
33
 
25
34
  def id=(s) @@id = s; self end
@@ -74,7 +83,10 @@ end
74
83
 
75
84
  def create_node(parent_node, child_schema, params={}, id=nil)
76
85
 
86
+ #puts 'create_node... child_schema : ' + child_schema
77
87
  record = Rexle.new PolyrexSchema.new(child_schema).to_s
88
+
89
+ #puts '@parent_node class: %s; xml: %s : ' % [@parent_node.class, @parent_node.xml]
78
90
 
79
91
  if id then
80
92
  @@id.succ!
@@ -89,6 +101,7 @@ end
89
101
  record.root.add_attribute({'id' => @@id.to_s.clone})
90
102
 
91
103
  a = child_schema[/[^\[]+(?=\])/].split(',')
104
+ #puts 'record : ' + record.xml
92
105
  summary = record.root.element('summary')
93
106
  a.each do |field_name|
94
107
  field = summary.element(field_name.strip)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyrex-createobject
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.13
4
+ version: 0.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -29,7 +29,7 @@ cert_chain:
29
29
  /uQTwOrEFUTOPchp29l7/+KRd0+d4xdI8OAlBC9K1aQn6PZYtusb3Fs0i6axJ5n+
30
30
  8Y81iY1zRvbtkGYb43OlUoUgtMRbmjkD
31
31
  -----END CERTIFICATE-----
32
- date: 2013-07-27 00:00:00.000000000 Z
32
+ date: 2013-12-25 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: polyrex-schema
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  version: '0'
73
73
  requirements: []
74
74
  rubyforge_project:
75
- rubygems_version: 2.0.0.rc.2
75
+ rubygems_version: 2.1.11
76
76
  signing_key:
77
77
  specification_version: 4
78
78
  summary: polyrex-createobject
metadata.gz.sig CHANGED
Binary file