polyrex 0.6.11 → 0.6.12
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.
- data/lib/polyrex.rb +5 -13
- metadata +1 -1
data/lib/polyrex.rb
CHANGED
@@ -18,14 +18,8 @@ class Polyrex
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def create(id=nil)
|
21
|
-
|
22
|
-
if @id.to_s[/[0-9]/] then
|
23
|
-
@id = (@id.to_i + 1).to_s
|
24
|
-
else
|
25
|
-
@id = XPath.first(@parent_node.root, 'count(//@id)').to_i + 2
|
26
|
-
end
|
27
21
|
@create.id = id || @id
|
28
|
-
|
22
|
+
@create.record = @parent_node
|
29
23
|
@create
|
30
24
|
end
|
31
25
|
|
@@ -35,7 +29,7 @@ class Polyrex
|
|
35
29
|
end
|
36
30
|
|
37
31
|
def record()
|
38
|
-
@
|
32
|
+
@parent_node
|
39
33
|
end
|
40
34
|
|
41
35
|
def to_xml()
|
@@ -161,7 +155,7 @@ class Polyrex
|
|
161
155
|
methodx = names.map do |name|
|
162
156
|
%Q(
|
163
157
|
def create_#{name.downcase}(params)
|
164
|
-
self.create.#{name.downcase}
|
158
|
+
self.create.#{name.downcase}
|
165
159
|
end
|
166
160
|
)
|
167
161
|
end
|
@@ -203,13 +197,12 @@ class Polyrex
|
|
203
197
|
@recordx.shift
|
204
198
|
end
|
205
199
|
|
206
|
-
@id = XPath.match(@doc.root, '//@id').map{|x| x.value.to_i}.max.to_i
|
200
|
+
@id = XPath.match(@doc.root, '//@id').map{|x| x.value.to_i}.max.to_i + 1
|
207
201
|
|
208
202
|
#puts 'schema : ' + schema
|
209
203
|
load_handlers(schema)
|
210
204
|
load_find_by(schema)
|
211
|
-
@parent_node =
|
212
|
-
@create.record = @parent_node
|
205
|
+
@parent_node = XPath.first(@doc.root,'records')
|
213
206
|
|
214
207
|
end
|
215
208
|
|
@@ -230,6 +223,5 @@ class Polyrex
|
|
230
223
|
|
231
224
|
self.instance_eval methodx.join("\n")
|
232
225
|
end
|
233
|
-
|
234
226
|
|
235
227
|
end
|