polyrex-createobject 0.5.5 → 0.5.6

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: 076919abc67a3b340d1397bfaceab31c9116db95
4
- data.tar.gz: c20dfbd93fdd4c10d96c27fa6d654ebff72fd2bf
3
+ metadata.gz: fca40843eaa53cdbdca54e03b44ff2e82b9410a8
4
+ data.tar.gz: e72b171e179981ab9a8db735d6c85a979b772f9f
5
5
  SHA512:
6
- metadata.gz: a20515d76d1a4a05091bf748124e3b691e864cb580988f62c61dad7bff3b9c7d26f56fda8bead2c3753f8c689fbe54b3db102f722e87d49122621749a76b7b03
7
- data.tar.gz: 923b57857ccd789eb69cf96816b6eb533a444104a7eceb5b94aac11c23e25f02b37d1f2ac8590aafb458cbbbcfe4f69ed94735bff526b4d6c2e90c9365bb17da
6
+ metadata.gz: e4d22b57a8a14ecba0b81f35b14dbbac924eaef0f4c5338d8724c05c1d79c2ce35054053a92b9a3b2f9287a765529157bbde8800e3913778b13bb72ec0020458
7
+ data.tar.gz: 893b88f149e183cea02a0b8df9ef7ba00e0e83c0056531bda3e86a9974a6ffc2473cf3bacbf9203f343b31c1bf232639bfb71ad5d150e2affe25e6a82221a2bb
checksums.yaml.gz.sig CHANGED
Binary file
@@ -21,30 +21,41 @@ class PolyrexCreateObject
21
21
 
22
22
  @schema = schema[/\/.*$/][1..-1]
23
23
  a = PolyrexSchema.new(schema).to_a
24
- @obj = attach_create_handlers(a[0])
25
24
 
26
- @obj.class_eval do
27
- def record=(node)
28
- @parent_node = node
25
+ a.each do |rec|
26
+
27
+ @obj = attach_create_handlers(rec)
28
+
29
+ @obj.class_eval do
30
+ def record=(node)
31
+ @parent_node = node
32
+ end
29
33
  end
30
- end
31
34
 
32
- self.instance_eval " def #{@obj.name.downcase}(h={}, id=@@id, &blk)
35
+ self.instance_eval %Q( def #{@obj.name.downcase}(h={}, id=@@id, &blk)
33
36
 
34
- new_parent = create_node(@parent_node, @schema, h, id).element('records')
37
+ local_schema = @schema
35
38
 
36
- obj = @obj.new
37
- obj.record = new_parent
38
- obj.instance_variable_set(:@schema, @schema[/\\/(.*$)/,1])
39
-
40
- if block_given? then
41
- blk.call obj
42
- else
43
- obj
39
+ if local_schema[0] == '{' then
40
+ fields = @schema[/#{obj.name.downcase}\\[([^\\]]+)/,1].split(/\\s*,\\s*/)
41
+ local_schema = "%s[%s]%s" % ['#{@obj.name.downcase}', fields.join(','),
42
+ local_schema[/\\/.*$/].to_s]
43
+ end
44
+
45
+ new_parent = create_node(@parent_node, local_schema, h, id).element('records')
46
+
47
+ obj = @obj.new
48
+ obj.record = new_parent
49
+ obj.instance_variable_set(:@schema, @schema[/\\/(.*$)/,1])
50
+
51
+ if block_given? then
52
+ blk.call obj
53
+ else
54
+ obj
55
+ end
44
56
  end
57
+ )
45
58
  end
46
- "
47
-
48
59
  end
49
60
 
50
61
  def id=(s) @@id = s; self end
@@ -71,10 +82,8 @@ class PolyrexCreateObject
71
82
 
72
83
  def create_node(parent_node, child_schema, params={}, id=nil)
73
84
 
74
- #buffer = PolyrexSchema.new(child_schema[/^[^\/]+/]).to_s
75
85
  record = PolyrexSchema.new(child_schema).to_doc
76
86
  record.root.xpath('records/.').each(&:delete)
77
- #record = Rexle.new buffer
78
87
 
79
88
  if id then
80
89
  @@id.succ!
@@ -173,7 +182,7 @@ class PolyrexCreateObject
173
182
 
174
183
 
175
184
  obj.record = new_parent
176
- #if block_given? then
185
+
177
186
  if blk then
178
187
  blk.call obj
179
188
  else
@@ -203,6 +212,11 @@ class PolyrexCreateObject
203
212
 
204
213
  id ||= @@id
205
214
  local_schema = @parent_node.parent.text('summary/schema')[/\/(.*$)/,1]
215
+ if local_schema[0] == '{' then
216
+
217
+ local_schema = "%s[%s]%s" % [cname, fields.join(','),
218
+ local_schema[/\/.*$/].to_s]
219
+ end
206
220
  new_parent = create_node(@parent_node, local_schema,
207
221
  params, id).element('records')
208
222
  obj = remaining.new
data.tar.gz.sig CHANGED
Binary file
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.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  f3O5lCaUfMDZbRHRyvXjy/4PFRQKLr6ZLbpQN+dWceS6/82/5xWEL/7Bo/86R5xN
32
32
  JL6pGH//inbMWQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2014-07-26 00:00:00.000000000 Z
34
+ date: 2014-07-27 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