polyrex-links 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/polyrex-links.rb +4 -11
- metadata +1 -1
data/lib/polyrex-links.rb
CHANGED
@@ -1,17 +1,13 @@
|
|
1
|
-
#!/usr/bin/ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# file: polyrex-links.rb
|
4
4
|
|
5
5
|
require 'polyrex'
|
6
6
|
|
7
|
-
class PolyrexLinks
|
7
|
+
class PolyrexLinks < Polyrex
|
8
8
|
|
9
9
|
def initialize(x='links/link[name,url]')
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
def parse(s)
|
14
|
-
@polyrex.parse s
|
10
|
+
super(x)
|
15
11
|
end
|
16
12
|
|
17
13
|
def locate(path)
|
@@ -24,13 +20,10 @@ class PolyrexLinks
|
|
24
20
|
|
25
21
|
begin
|
26
22
|
c = a2.shift; xpath = c.map{|x| mask % x}.join + '/summary/url/text()'
|
27
|
-
r =
|
23
|
+
r = self.element xpath
|
28
24
|
end until r or a2.empty?
|
29
25
|
|
30
26
|
r ? r + path.sub(c.join('/'),'') : nil
|
31
27
|
end
|
32
28
|
|
33
|
-
def to_xml(options={})
|
34
|
-
@polyrex.to_xml(options)
|
35
|
-
end
|
36
29
|
end
|