rexle 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rexle.rb +15 -5
- metadata +2 -2
data/lib/rexle.rb
CHANGED
@@ -58,10 +58,10 @@ class Rexle
|
|
58
58
|
|
59
59
|
if xpath_value[0,2] == '//' then
|
60
60
|
s = a[2]
|
61
|
-
elsif xpath_value == 'text()' then
|
61
|
+
elsif xpath_value == 'text()' then
|
62
|
+
a.shift
|
62
63
|
return @value
|
63
64
|
else
|
64
|
-
|
65
65
|
attribute = xpath_value[/^attribute::(.*)/,1]
|
66
66
|
return @attributes[attribute] if attribute
|
67
67
|
|
@@ -103,16 +103,26 @@ class Rexle
|
|
103
103
|
rlist = return_elements.map.with_index {|x,i| filter(x, i+1, attr_search)}
|
104
104
|
rlist
|
105
105
|
else
|
106
|
+
|
106
107
|
return_elements.map.with_index do |x,i|
|
107
108
|
rtn_element = filter(x, i+1, attr_search){|e| r = e.xpath(a.join('/'), rlist); r || e }
|
108
|
-
|
109
|
-
|
110
|
-
|
109
|
+
if rtn_element.is_a? String then
|
110
|
+
rlist << rtn_element
|
111
|
+
else
|
112
|
+
if rtn_element.is_a? Element then
|
113
|
+
rlist = rlist + rtn_element
|
114
|
+
else
|
115
|
+
if rtn_element.is_a? Array then
|
116
|
+
rlist << rtn_element unless rtn_element[0].is_a? String
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
111
120
|
end
|
112
121
|
end
|
113
122
|
else
|
114
123
|
# strip off the 1st element from the XPath
|
115
124
|
new_xpath = xpath_value[/^\/\/\w+\/(.*)/,1]
|
125
|
+
|
116
126
|
if new_xpath then
|
117
127
|
self.xpath(new_xpath, rlist)
|
118
128
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rexle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
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
|
+
date: 2010-11-03 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|