polyrex 0.7.8 → 0.7.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/polyrex.rb +7 -6
- metadata +2 -2
data/lib/polyrex.rb
CHANGED
@@ -19,8 +19,9 @@ class Polyrex
|
|
19
19
|
|
20
20
|
def create(id=nil)
|
21
21
|
# @create is a PolyrexCreateObject, @parent_node is a REXML::Element pointing to the current record
|
22
|
-
@create.id = (id || @id)
|
23
|
-
|
22
|
+
@create.id = (id || @id.succ!)
|
23
|
+
|
24
|
+
@create.record = @parent_node.name == 'records' ? @parent_node : @parent_node.element('records')
|
24
25
|
@create
|
25
26
|
end
|
26
27
|
|
@@ -65,7 +66,7 @@ class Polyrex
|
|
65
66
|
end
|
66
67
|
|
67
68
|
def xpath(s, &blk)
|
68
|
-
|
69
|
+
|
69
70
|
if block_given? then
|
70
71
|
@doc.xpath(s, &blk)
|
71
72
|
else
|
@@ -188,12 +189,12 @@ class Polyrex
|
|
188
189
|
|
189
190
|
def open(s)
|
190
191
|
|
191
|
-
if s[
|
192
|
+
if s[/</] # xml
|
193
|
+
buffer = s
|
194
|
+
elsif s[/\[/] then # schema
|
192
195
|
buffer = polyrex_new s
|
193
196
|
elsif s[/^https?:\/\//] then # url
|
194
197
|
buffer = Kernel.open(s, 'UserAgent' => 'Polyrex-Reader').read
|
195
|
-
elsif s[/</] # xml
|
196
|
-
buffer = s
|
197
198
|
else # local file
|
198
199
|
buffer = File.open(s,'r').read
|
199
200
|
end
|
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.7.
|
4
|
+
version: 0.7.9
|
5
5
|
platform: ruby
|
6
6
|
authors: []
|
7
7
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-12-
|
12
|
+
date: 2010-12-25 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|