rexle 0.1.3 → 0.1.4

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 +6 -7
  2. metadata +1 -1
data/lib/rexle.rb CHANGED
@@ -9,7 +9,7 @@ class Rexle
9
9
  end
10
10
 
11
11
  def xpath(path)
12
- @doc.xpath path
12
+ @doc.xpath(path).flatten.compact
13
13
  end
14
14
 
15
15
  class Element
@@ -55,7 +55,6 @@ class Rexle
55
55
  end
56
56
 
57
57
  attr_search = items.join(' ')
58
- puts 'attr_search : ' + attr_search
59
58
 
60
59
  end
61
60
 
@@ -63,9 +62,9 @@ class Rexle
63
62
 
64
63
  if return_elements.length > 0 then
65
64
  if a.empty? then
66
- return_elements.map {|x| filter(x, attr_search)}.compact!
65
+ return_elements.map {|x| puts 'x : ' + x.inspect; filter(x, attr_search)} # .compact!
67
66
  else
68
- return_elements.map {|x| filter(x, attr_search){|e| e.xpath a.join }}.flatten
67
+ return_elements.map {|x| puts 'x2 : ' + x.inspect; filter(x, attr_search){|e| e.xpath a.join }}
69
68
  end
70
69
  end
71
70
  end
@@ -80,11 +79,11 @@ class Rexle
80
79
  x = raw_element
81
80
  e = @child_elements[x.last]
82
81
 
83
- if attr_search.empty? then
84
- block_given? ? blk.call(e) : e
85
- else
82
+ if attr_search then
86
83
  h = x[0][1]
87
84
  block_given? ? blk.call(e) : e if h and eval(attr_search)
85
+ else
86
+ block_given? ? blk.call(e) : e
88
87
  end
89
88
  end
90
89
 
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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors: []
7
7