rexle 1.3.20 → 1.3.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13914206676963d56c9a33f53675fa7e37c9cb61
4
- data.tar.gz: 16b304b9a20a10940b7e1f8b919234ef2d44be28
3
+ metadata.gz: 4dbefefe2ee7e079624cf397cd956515d26fcb47
4
+ data.tar.gz: 55f6a9d18b0e0b2c547d585dbb117705978b5991
5
5
  SHA512:
6
- metadata.gz: e0bda0e89b6c9d01bcd6fc676a658d40d8ab5352f851d701a7be3bd9413efe7944b187079fc307fa74145092aaaaf83f684f6e3efd7b6aa28415b2c960bf79c1
7
- data.tar.gz: 8925d282bb3314f758b6b5458208594f9b829d304dd535cd2afb83ddd5d532789aea211d36a2bbd9b096c865d72d3311078492ae2d932c1b0a1263be5f0e6c1d
6
+ metadata.gz: 74c97ba08e685e66b599de477e99ca56af1c250362310dbb0e6e3f01294819c3accaf4b790eb88f04f81c1768f293d9f175d7045fbe5e196bfb15cd3d3ee1f83
7
+ data.tar.gz: 2d9ad02d1e4cea5cbd320909df7840049e1402b241a0445814bd2dfab3298f400d47d52b14c858d62ba067f9c5ac59e140421f707f16fb06404dd0996dbb4f1c
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -12,7 +12,9 @@ require 'backtrack-xpath'
12
12
 
13
13
  # modifications:
14
14
 
15
- # 21-Apr-2016: An xpath predicate can now contain the mod operator as well as
15
+ # 21-Apr-2016: feature: The element index can now be used through an
16
+ # xpath block parameter
17
+ # An xpath predicate can now contain the mod operator as well as
16
18
  # containing nested logic e.g. [(position() mod 2) == 1]
17
19
  # 16-Apr-2016: improvement: The HTML element div is no longer printed as
18
20
  # a self-closing tag if empty
@@ -1137,7 +1139,7 @@ class Rexle
1137
1139
  r6
1138
1140
  else
1139
1141
 
1140
- block_given? ? blk.call(e) : e
1142
+ block_given? ? blk.call(e, i) : e
1141
1143
  end
1142
1144
 
1143
1145
  end
@@ -1145,21 +1147,21 @@ class Rexle
1145
1147
  def attribute_search(attr_search, e, h, i=nil, &blk)
1146
1148
 
1147
1149
  r2 = if attr_search.is_a? Fixnum then
1148
- block_given? ? blk.call(e) : e if i == attr_search
1150
+ block_given? ? blk.call(e,i) : e if i == attr_search
1149
1151
  elsif attr_search[/i\s(?:<|>|==|%)\s\d+/] and eval(attr_search) then
1150
- block_given? ? blk.call(e) : e
1152
+ block_given? ? blk.call(e,i) : e
1151
1153
  elsif h and !h.empty? and attr_search[/^h\[/] and eval(attr_search) then
1152
- block_given? ? blk.call(e) : e
1154
+ block_given? ? blk.call(e,i) : e
1153
1155
  elsif attr_search[/^\(name ==/] and e.child_elements.select {|x|
1154
1156
  next unless x.is_a? Rexle::Element
1155
1157
  name, attributes, value = x.name, x.attributes, x.value.to_s
1156
1158
  b = eval(attr_search)
1157
1159
  b}.length > 0
1158
1160
 
1159
- block_given? ? blk.call(e) : e
1161
+ block_given? ? blk.call(e,i) : e
1160
1162
 
1161
1163
  elsif attr_search[/^\(name ==/] and eval(attr_search)
1162
- block_given? ? blk.call(e) : e
1164
+ block_given? ? blk.call(e,i) : e
1163
1165
  elsif attr_search[/^e\.value/]
1164
1166
 
1165
1167
  v = attr_search[/[^\s]+$/]
@@ -1167,12 +1169,12 @@ class Rexle
1167
1169
  attr_search.sub!(/^e.value/,'e.value.' + duck_type)
1168
1170
 
1169
1171
  if eval(attr_search) then
1170
- block_given? ? blk.call(e) : e
1172
+ block_given? ? blk.call(e,i) : e
1171
1173
  end
1172
1174
  elsif attr_search[/e\.xpath/] and eval(attr_search)
1173
- block_given? ? blk.call(e) : e
1175
+ block_given? ? blk.call(e,i) : e
1174
1176
  elsif attr_search[/^\w+\(/] and e.element(attr_search)
1175
- block_given? ? blk.call(e) : e
1177
+ block_given? ? blk.call(e,i) : e
1176
1178
  end
1177
1179
 
1178
1180
  r2
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: 1.3.20
4
+ version: 1.3.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file