rexle 0.2.8 → 0.2.9

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 +13 -4
  2. metadata +1 -1
@@ -86,13 +86,14 @@ class Rexle
86
86
  end
87
87
  attr_search = items.join(' ')
88
88
  end
89
+ condition = "[" + condition
89
90
 
90
91
  end
91
92
 
92
93
  wildcard = xpath_value[0,2] == '//'
93
94
 
94
95
  if wildcard then
95
- return scan_match(self, element_name, rlist)
96
+ return scan_match(self, element_name, attr_search, condition, rlist)
96
97
  end
97
98
 
98
99
  return_elements = @child_lookup.map.with_index.select {|x| x[0][0] == element_name or element_name == '*'}
@@ -120,10 +121,18 @@ class Rexle
120
121
  rlist
121
122
  end
122
123
 
123
- def scan_match(nodes, element, rlist)
124
+ def scan_match(nodes, element, attr_search, condition, rlist)
124
125
  nodes.children.each.with_index do |x, i|
125
- rlist << x if x.name == element
126
- x.xpath('//' + element, rlist) unless x.children.empty?
126
+ if x.name == element
127
+ h = x.attributes
128
+ if attr_search then
129
+ rlist << x if h and eval(attr_search)
130
+ else
131
+ rlist << x
132
+ end
133
+ end
134
+
135
+ x.xpath('//' + element + condition, rlist) unless x.children.empty?
127
136
  end
128
137
  rlist
129
138
  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.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors: []
7
7