rexle 1.0.26 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61f8f06a3e6eb1187c078a6133541141bd918240
4
- data.tar.gz: 8ae5b1f3444c5cd080be68cccd55358915c2b148
3
+ metadata.gz: ab26e53944edc50b881c1145d16427d4323e6f5d
4
+ data.tar.gz: 18bd7854feecfa76f4c8c0369a99a47eb5d7532f
5
5
  SHA512:
6
- metadata.gz: ec75334ddf26c1ceb20aac45996875f0c77de01c9466446cd8b56acce00d96720ba418d275e874de47500592a2a88628877d9c76f2d8c65b02ce68cf0551d0bd
7
- data.tar.gz: 6d7f6e1d5923b10f42ee7297e5f9ff8778498a925949664359eaef22d247bde9bb8c8dda46dc60d3a8d11d1e1c097ff9b8f9086b90919f5a41919658d29f1844
6
+ metadata.gz: ffa75f7be8303dffcac407e07f6c53498fbccebab53823ebfde5154f1a894f0e52d606e6ff274b443ca2b7e775e6b55b25f14aebb1537effaf2fb00aa302324d
7
+ data.tar.gz: 3ac62dceb04d8d3eaeeefcac503c25a07df7e69a437da44d40cca3229f55d5cf65cbde7cd5af4fbabc694bf1c7c7ed72705c4e0af92e5ec08a7107e4712a0ff4
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/rexle.rb CHANGED
@@ -12,6 +12,8 @@ include REXML
12
12
 
13
13
  # modifications:
14
14
 
15
+ # 19-Oct-2014: feature: An XPath containing the attribute @class is
16
+ # now treated as a type of CSS selector storage area
15
17
  # 13-Oct-2014: feature: Implemented Rexle#clone
16
18
  # 12-Oct-2014: feature: Implemented CSS style element selection
17
19
  # 27-Sep-2014: bug fix: ELement values are now explicitly transformed to string
@@ -752,14 +754,19 @@ class Rexle
752
754
  indices = [0] + andor_items + [raw_items.length]
753
755
 
754
756
  if raw_items[0][0] == '@' then
757
+
755
758
  raw_items.each{|x| x.gsub!(/^@/,'')}
756
759
  cons_items = indices.each_cons(2).map{|x,y| raw_items.slice(x...y)}
757
760
 
758
761
  items = cons_items.map do |x|
759
762
 
760
763
  if x.length >= 3 then
761
- x[1] = '==' if x[1] == '='
762
- "h[:'%s'] %s %s" % x
764
+ if x[0] != 'class' then
765
+ x[1] = '==' if x[1] == '='
766
+ "h[:'%s'] %s %s" % x
767
+ else
768
+ "h[:class].include? %s" % x.last
769
+ end
763
770
  else
764
771
 
765
772
  x.join[/^(and|or)$/] ? x : ("h[:'%s']" % x)
@@ -859,7 +866,7 @@ class Rexle
859
866
  block_given? ? blk.call(e) : e if i == attr_search
860
867
  elsif attr_search[/i\s[<>\=]\s\d+/] and eval(attr_search) then
861
868
  block_given? ? blk.call(e) : e
862
- elsif h and attr_search[/^h\[/] and eval(attr_search)
869
+ elsif h and !h.empty? and attr_search[/^h\[/] and eval(attr_search) then
863
870
  block_given? ? blk.call(e) : e
864
871
  elsif attr_search[/^\(name ==/] and e.child_lookup.select{|name, attributes, value| eval(attr_search) }.length > 0
865
872
  block_given? ? blk.call(e) : e
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.0.26
4
+ version: 1.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  UOGKUMV5RApHDnC0ywMYNe0HK7qMSTP5YLKs8JUjNxpc5jl8+o3D3sHkNN4DzbQm
32
32
  jVfzDZ+niKvAUA==
33
33
  -----END CERTIFICATE-----
34
- date: 2014-10-13 00:00:00.000000000 Z
34
+ date: 2014-10-19 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rexleparser
metadata.gz.sig CHANGED
Binary file