rexle-xpath 0.2.19 → 0.2.20

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: a6830597770b873aa7b054e23d48deac4df7f203
4
- data.tar.gz: 0b4b8f7dd040ee4a6d875c75690e02b75f5fd647
3
+ metadata.gz: 8ad7a52975232684fb9a4803036fcd94296d7e5e
4
+ data.tar.gz: e8f96d4b9775c001b4c6e49bab3d1d8dbfe4362f
5
5
  SHA512:
6
- metadata.gz: 0b827b5c398cb520dc0cdd27810504f696a1dbc0ce87caec856a329323004847c06d4af8734f6cc637826fe3a36a3a1daf3a91517f731cb68ba230ac9973df48
7
- data.tar.gz: 27c6d89519ee72af78975f69426e18edddcc682b97c36318296d040b4126fcf27b2790f066e7399c022e6f615269bcc338d2e1a0deaccb4561d7f1e6d0be1652
6
+ metadata.gz: def3a91c928ab1d35e60a07e972375629a4c64378fb4d1db868977d41ff0fbd35e4504151e1e912f18f3f56b7cd9f0a53785deac5ee2be2dce86f1e6c38a7a71
7
+ data.tar.gz: 9f6a2110818b5c027fd1aa579efa51f35b114f9fa55621011155e3fc88c3b9042e9dfe683e9d319941ee341c50409fce69ca4c5362d6119a3f0c03a174061746
@@ -1,3 +1,2 @@
1
- �g=)��hҡ�S�%L��H6N��%h���h��@Nӈ,�Ԝl�g8�h/t�?0��v��x$gt'�5<"��)5� ���N�\�U����u::9I;a�����}��Ţׅ=�q.� ��;Q��G�?��~���{���%��ϳY �`J��UbeLPm�''��^�j�2�SF)����.
2
- H�����nh�ު
3
- (�����y��@�[�,S�h�O�*�<�"��(�w��W��?'�r�u�
1
+ ��v���c��<� o���5[��8��3��s� XI�Q�qI�ɳ�"h
2
+ ����H��h15MN�T���Y�f��Y���vxph��-�Nn�؝�� �vG��)>�A�R>.�"B��pm���4C�|��d���FWǹvc�~�.k\�[T�h:����d"Y�z!_�G��6�M(�9������o�F���w@0����=$�<�o��ѕ��Yj�'����ҁ˩U\��q}&"ݵ�� ��ň�
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- �.�jTK�ǫ�"�� �‘*�iWPԸ�t&º"�Ű(�9=� er9yJ����Zg�5�ͽ��,� ��z��ӌA���A[����Ű:� |��M�=8���9��j���e5)H��Xy$Q������[knӷ�'����GT��
1
+ o(3�u�������xѼ��Z�F�G�ds]�MB�aK���V1�R}��>�",�%HX���(���������� ��q5R}��똫�mv�Gǐ��o�3��aA���A=B��)�|��*�bc\�l۱H[�hֈ !� ��Ԩ�N����7fq�,I��-�(�yJCr$����8^NM���a_�~�:��?Tgi *g��M�J$�<�U��x�ć'8��c&��h�Vd�;�K9?��E�n������
@@ -53,12 +53,41 @@ class RexleXPath
53
53
  debug :query, node: node, xpath_instructions: xpath_instructions
54
54
 
55
55
  row = xpath_instructions.shift
56
- method_name, *args = row
56
+ method_name, *args = row
57
57
 
58
58
  return query xpath_instructions, node if row == :|
59
59
 
60
- if row.is_a? Array and row.first.is_a? Array then
61
- return query row + xpath_instructions, node
60
+ if row.is_a? Array and row.first.is_a? Array then
61
+
62
+ unless row.any? {|x| x == :|} then
63
+
64
+ return query row + xpath_instructions, node
65
+ else
66
+
67
+ a = row
68
+
69
+ a2 = a.inject([[]]) do |r, x|
70
+
71
+ if x != :| then
72
+
73
+ if r.last.is_a? Array then
74
+ r.last << x
75
+ else
76
+ r << [x]
77
+ end
78
+
79
+ else
80
+ r.unshift x
81
+ r << []
82
+ end
83
+ r
84
+ end
85
+
86
+ name = a2.shift
87
+ r3 = method(name).call(a2, node)
88
+ return r3
89
+
90
+ end
62
91
  end
63
92
 
64
93
  result = if method_name == :predicate then
@@ -83,11 +112,19 @@ class RexleXPath
83
112
 
84
113
  private
85
114
 
115
+
116
+ def |(args=[], node)
117
+ r = args.flat_map {|x| query x, node}
118
+ r.any?
119
+ end
120
+
121
+
86
122
  def attribute(node, args, xpath_instructions)
87
123
 
88
- debug :attribute, node: node, xpath_instructions: xpath_instructions
124
+ debug :attribute, args: args, node: node,
125
+ xpath_instructions: xpath_instructions
89
126
 
90
- key = args.first.to_sym
127
+ key = args.first.is_a?(Array) ? args.first.first.to_sym : args.first.to_sym
91
128
 
92
129
  attr = node.attributes[key]
93
130
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexle-xpath
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.19
4
+ version: 0.2.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  nbFbbz3OsHrrR6h7FB5a8wQzCvYMtAr9VMPNl01QqBRi2wCEr6hR3gGBY0T1ZT5P
32
32
  qYzPWuECaMhR5w==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-07-09 00:00:00.000000000 Z
34
+ date: 2017-02-19 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rexle-xpath-parser
@@ -54,7 +54,7 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: 0.1.13
56
56
  description:
57
- email: james@r0bertson.co.uk
57
+ email: james@jamesrobertson.eu
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 2.5.1
83
+ rubygems_version: 2.6.8
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Under development, and is not currently used by the Rexle gem.
metadata.gz.sig CHANGED
@@ -1,4 +1 @@
1
-
2
-
3
- �T�ulyY�z�j=����R��M&)̒�',nd�1�4�gH8�]ܬ��_�s\%���H7 w�z��+`w�gq�g͌���������,h��QF��ͨ�Pq�-X�b�
4
- ��W n�YW\`��֥ �� ���ɾ$��7�T誮%h�q'��P���ryb�g���҅�}c<���.r��%]Ea��jw�5��t�,9�� j[�(xl�#�����d9�
1
+ N�ī�}`i!�'U��]~:�vP}� |;