rexle-xpath-parser 0.1.4 → 0.1.5

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: ae7e450416eff042a5fd74f13acac2ccc8776e9f
4
- data.tar.gz: 4370f0becd6d8b0a0bccdc3b238f296ba34e8242
3
+ metadata.gz: 68a2052570eb11931e4732131e891183b8be7fe4
4
+ data.tar.gz: 2ea45650f8cdfa915bbc9d3f35b03214cb6d4523
5
5
  SHA512:
6
- metadata.gz: 1d03728e8f4fc8956478bf2255bb1535834d1acb374fc936ced40ad703d4ebdec0287ee2e7c3321971e9369cafdbdf5d57887dbf98193ef516cb1972eda571e7
7
- data.tar.gz: 6b6320900430ccf877871072f1f9bfd20e85f423f8d9ac22c95a231ec1968beea2025f248fd2e357d7bff75c112b1c07b0d53486c4252a83717bb45a5bb39a9f
6
+ metadata.gz: 01d110d48b90f842c14601b1409f4c7b7d399f0001b51a74f3ef6307c2fe4a535f9d98283210f9cfbadf4635e9f743b5294cb4039f184ba3ff822907b759e9af
7
+ data.tar.gz: 0d59600fc1dc3b7b5136e53e59e422d163f5b9903d7a3d2adf6a19cedbf303456f8797489a1a0dd435f5a1bbd69c3658a9d9b9b907d3155094fb2941f09c16ff
checksums.yaml.gz.sig CHANGED
@@ -1 +1,2 @@
1
- �T-���Z^�].=ni���O��^B��W`��Ǝ����IDX\;GU��3��{{�;8I���s2s���1�*KT��i0�;�F_K-�G���.Ob���=��I������SߘV���?gtW��Ů��3-Q�V�]�]�\���2Y��&�h�֜�4��_�lQ��*�4��o �j�����88U{9��X��L�����}>���˜?Gn9p/�W�RkR ���I���n�)�����ߧ
1
+ ���k\�xx!(jx� `�@���`F�(mF(��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
@@ -24,37 +24,35 @@ class RexleXPathParser
24
24
  #
25
25
  def functionalise(a)
26
26
 
27
- a.map do |x|
27
+ a.inject([]) do |r,x|
28
28
 
29
- r = if x =~ /[\w\/]+\[/ then
29
+ if x =~ /[\w\/]+\[/ then
30
30
 
31
31
  epath, predicate, remainder = x.match(/^([^\[]+)\[([^\]]+)\](.*)/).captures
32
32
 
33
- r = if remainder.length > 0 then
33
+ if remainder.length > 0 then
34
34
  remainder.slice!(0) if remainder[0] == '/'
35
- r = functionalise(match(remainder))
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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexle-xpath-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- t����rkr1��^li��v���xK ������]�?/;�6ut�(�~�Ҥ�����q�q:�O<-(�Q�f��F�q�Vf8Aߓ��� T������Unr��2zx7X�F豭}���##4u�����`%����f�(+��T���{�v�/gr�>��I&�8]��_�&8]���� �ۥM�e�Ξ�H8;^P �{"
2
- �:ms��G���B�w3vN:��>Y$z�|im\�<��
1
+ Aa�����x6��ѥ�4"ԼIVj���I[�+j�&�Q"3b{�
2
+ B�~7}cUͳm��8������_����f����@��]S_f��`��ݖ����)���egA&�I��@?PX�*U���!�ѩ#��3��?�ך@����;�&�*����Y��VD�.#�d?7�~���t{�U�.��d��K��ˏs5��w�+�v�
3
+ v��M�J~���#U�ES�;��q���#�H/�G���8���4�_