polyrex 0.7.8 → 0.7.9

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.
Files changed (2) hide show
  1. data/lib/polyrex.rb +7 -6
  2. 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
- @create.record = @parent_node
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
- #XPath.first(@doc.root, s)
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[/\[/] then # schema
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.8
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-18 00:00:00 +00:00
12
+ date: 2010-12-25 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency