rexle-xpath-parser 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -1
- data.tar.gz.sig +0 -0
- data/lib/rexle-xpath-parser.rb +11 -13
- metadata +1 -1
- metadata.gz.sig +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68a2052570eb11931e4732131e891183b8be7fe4
|
4
|
+
data.tar.gz: 2ea45650f8cdfa915bbc9d3f35b03214cb6d4523
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01d110d48b90f842c14601b1409f4c7b7d399f0001b51a74f3ef6307c2fe4a535f9d98283210f9cfbadf4635e9f743b5294cb4039f184ba3ff822907b759e9af
|
7
|
+
data.tar.gz: 0d59600fc1dc3b7b5136e53e59e422d163f5b9903d7a3d2adf6a19cedbf303456f8797489a1a0dd435f5a1bbd69c3658a9d9b9b907d3155094fb2941f09c16ff
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
����k\�x�x!(jx�`�@���`F�(m�F(��BwBX S�
|
2
|
+
k(��q�l�g6��3�f�[y���ς�c�%���;,NḬޯ(�YC��F�<,�z�z�ѠKdZ�d�/]�x�F>&ϊ���d·>��a�} 0���8�b��h^�9�h�����i�l-o}�)S��+��ݍ�[�7��E߬SHa�p�)���cmx+�AZ��6DG��ب��x��g��g}EQ*�q����5�u��x�/���
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rexle-xpath-parser.rb
CHANGED
@@ -24,37 +24,35 @@ class RexleXPathParser
|
|
24
24
|
#
|
25
25
|
def functionalise(a)
|
26
26
|
|
27
|
-
a.
|
27
|
+
a.inject([]) do |r,x|
|
28
28
|
|
29
|
-
|
29
|
+
if x =~ /[\w\/]+\[/ then
|
30
30
|
|
31
31
|
epath, predicate, remainder = x.match(/^([^\[]+)\[([^\]]+)\](.*)/).captures
|
32
32
|
|
33
|
-
|
33
|
+
if remainder.length > 0 then
|
34
34
|
remainder.slice!(0) if remainder[0] == '/'
|
35
|
-
r
|
35
|
+
r << functionalise(match(remainder))
|
36
36
|
else
|
37
|
-
|
37
|
+
r
|
38
38
|
end
|
39
39
|
|
40
40
|
epath.split('/').map {|e| [:select, e]} << \
|
41
41
|
[:predicate, RexleXPathParser.new(predicate).to_a] + r
|
42
42
|
|
43
43
|
elsif x =~ /=/
|
44
|
-
[:text, :==, x[/=(.*)/,1].sub(/^["'](.*)["']$/,'\1')]
|
44
|
+
r[-1] << [:text, :==, x[/=(.*)/,1].sub(/^["'](.*)["']$/,'\1')]
|
45
45
|
elsif x =~ /\|/
|
46
|
-
[:union]
|
46
|
+
r << [:union]
|
47
47
|
elsif x =~ /\w+\(/
|
48
|
-
[x.chop.to_sym]
|
48
|
+
r << [x.chop.to_sym]
|
49
49
|
elsif x =~ /\d+/
|
50
|
-
[:index, x[1..-2]]
|
50
|
+
r << [:index, x[1..-2]]
|
51
51
|
elsif x =~ /[\w\/]+/
|
52
|
-
x.split('/').map {|e| [:select, e]}
|
52
|
+
r << x.split('/').map {|e| [:select, e]}
|
53
53
|
elsif x.is_a? Array
|
54
|
-
functionalise(x)
|
54
|
+
r << functionalise(x)
|
55
55
|
end
|
56
|
-
|
57
|
-
r
|
58
56
|
|
59
57
|
end
|
60
58
|
|
metadata
CHANGED
metadata.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
Aa�����x6��ѥ�4"ԼIV�j���I[�+j�&�Q"3b{�
|
2
|
+
B�~7}cUͳm��8������_����f����@��]�S_f��`��ݖ����)���e�g�A&�I��@?PX�*U���!�ѩ#��3��?�ך@����;�&�*����Y��V�D�.#�d?7�~���t{�U�.��d��K��ˏs�5��w�+�v�
|
3
|
+
v��M�J~���#U�ES�;��q���#�H/�G���8���4�_
|