polyrex 0.7.6 → 0.7.7

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 +13 -3
  2. metadata +2 -2
@@ -64,9 +64,19 @@ class Polyrex
64
64
  self
65
65
  end
66
66
 
67
- def xpath(s)
68
- @doc.xpath s
67
+ def element(s)
68
+ @doc.element(s)
69
69
  end
70
+
71
+ def xpath(s, &blk)
72
+ #XPath.first(@doc.root, s)
73
+ if block_given? then
74
+ @doc.xpath(s, &blk)
75
+ else
76
+ @doc.xpath s
77
+ end
78
+ end
79
+
70
80
 
71
81
  def records
72
82
  @doc.xpath("records/*").map do |record|
@@ -186,7 +196,7 @@ class Polyrex
186
196
  buffer = polyrex_new s
187
197
  elsif s[/^https?:\/\//] then # url
188
198
  buffer = Kernel.open(s, 'UserAgent' => 'Polyrex-Reader').read
189
- elsif s[/\</] # xml
199
+ elsif s[/</] # xml
190
200
  buffer = s
191
201
  else # local file
192
202
  buffer = File.open(s,'r').read
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.6
4
+ version: 0.7.7
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-09 00:00:00 +00:00
12
+ date: 2010-12-15 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency