polyrex-createobject 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/polyrex-createobject.rb +34 -20
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: fca40843eaa53cdbdca54e03b44ff2e82b9410a8
|
4
|
+
data.tar.gz: e72b171e179981ab9a8db735d6c85a979b772f9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4d22b57a8a14ecba0b81f35b14dbbac924eaef0f4c5338d8724c05c1d79c2ce35054053a92b9a3b2f9287a765529157bbde8800e3913778b13bb72ec0020458
|
7
|
+
data.tar.gz: 893b88f149e183cea02a0b8df9ef7ba00e0e83c0056531bda3e86a9974a6ffc2473cf3bacbf9203f343b31c1bf232639bfb71ad5d150e2affe25e6a82221a2bb
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/polyrex-createobject.rb
CHANGED
@@ -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
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
35
|
+
self.instance_eval %Q( def #{@obj.name.downcase}(h={}, id=@@id, &blk)
|
33
36
|
|
34
|
-
|
37
|
+
local_schema = @schema
|
35
38
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
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.
|
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-
|
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
|