rexle 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rexle.rb +15 -3
  2. metadata +2 -2
data/lib/rexle.rb CHANGED
@@ -38,7 +38,12 @@ class Rexle
38
38
  def xpath(xpath_value)
39
39
 
40
40
  a = xpath_value.split('/')
41
- s = a.shift
41
+
42
+ if xpath_value[0,2] == '//' then
43
+ s = a[2]
44
+ else
45
+ s = a.shift
46
+ end
42
47
 
43
48
  element_name, condition = s.split(/\[/)
44
49
 
@@ -58,13 +63,20 @@ class Rexle
58
63
 
59
64
  end
60
65
 
66
+ wildcard = element_name[0,2] == '//'
61
67
  return_elements = @child_lookup.map.with_index.select {|x| x[0][0] == element_name}
62
68
 
63
69
  if return_elements.length > 0 then
64
70
  if a.empty? then
65
- return_elements.map {|x| puts 'x : ' + x.inspect; filter(x, attr_search)} # .compact!
71
+ return_elements.map {|x| filter(x, attr_search)}
66
72
  else
67
- return_elements.map {|x| puts 'x2 : ' + x.inspect; filter(x, attr_search){|e| e.xpath a.join }}
73
+ return_elements.map {|x| filter(x, attr_search){|e| r = e.xpath a.join('/'); r || e }}
74
+ end
75
+ else
76
+ # strip off the 1st element from the XPath
77
+ new_xpath = xpath_value[/^\/\/\w+\/(.*)/,1]
78
+ if new_xpath then
79
+ self.xpath new_xpath
68
80
  end
69
81
  end
70
82
  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.1.4
4
+ version: 0.1.5
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-10-19 00:00:00 +01:00
12
+ date: 2010-10-20 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15