rexle-xpath-parser 0.1.12 → 0.1.13
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/rexle-xpath-parser.rb +19 -9
- metadata +2 -2
- metadata.gz.sig +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 1efc1cfcaabc220aee650537721c02d544daee81
         | 
| 4 | 
            +
              data.tar.gz: c1678f213e2d75ac6de6e2cd02107905b147ef49
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 0840ba3af56bffdb9aa0ad72ad26a51698ef1cd0f3a69b33653bcefe12d5ce95c3ea89813051d80daa7ab04b1081f3d8caa1bce194f7301586fea9d144420a55
         | 
| 7 | 
            +
              data.tar.gz: 1393af65fd02efd0f1a65f541faf1d4c4fde078b234a51bf9c98592b738d85bd3d835b3adf08ebb275d7ad73f6213de378dbbc884280d7adc3ed978a9076cc45
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | Binary file | 
    
        data.tar.gz.sig
    CHANGED
    
    | Binary file | 
    
        data/lib/rexle-xpath-parser.rb
    CHANGED
    
    | @@ -22,21 +22,19 @@ class RexleXPathParser | |
| 22 22 | 
             
              # maps the nested tokens to XPath functions, predicates, operators, 
         | 
| 23 23 | 
             
              #                                                      and 1 or more elements
         | 
| 24 24 | 
             
              #  
         | 
| 25 | 
            -
              def functionalise(a)
         | 
| 25 | 
            +
              def functionalise(a, r2=[])
         | 
| 26 26 |  | 
| 27 | 
            -
                a.inject( | 
| 28 | 
            -
             | 
| 29 | 
            -
                  #puts 'x: ' + x.inspect
         | 
| 27 | 
            +
                a.inject(r2) do |r,x|
         | 
| 30 28 |  | 
| 31 29 | 
             
                  return r << functionalise(x) if x.is_a? Array
         | 
| 32 30 |  | 
| 33 | 
            -
                  if /^(?<func>\w+)\(\)/ then
         | 
| 31 | 
            +
                  if /^(?<func>\w+)\(\)/ =~ x then
         | 
| 34 32 | 
             
                    r << func.to_sym
         | 
| 35 33 | 
             
                  elsif /^@(?<attribute>[\w\/]+)/ =~ x
         | 
| 36 34 | 
             
                    r << [[:attribute, attribute]]
         | 
| 37 35 | 
             
                  elsif x =~ /^\/\//
         | 
| 38 36 | 
             
                    r << [:recursive, *RexleXPathParser.new(x[2..-1]).to_a]                
         | 
| 39 | 
            -
                  elsif x =~  | 
| 37 | 
            +
                  elsif x =~ /^[\w\/]+\[/
         | 
| 40 38 |  | 
| 41 39 | 
             
                    epath, predicate, remainder = x.match(/^([^\[]+)\[([^\]]+)\](.*)/).captures
         | 
| 42 40 |  | 
| @@ -60,8 +58,17 @@ class RexleXPathParser | |
| 60 58 | 
             
                    r << [:index, x]
         | 
| 61 59 | 
             
                  elsif /^attribute::(?<attribute>\w+)/ =~ x
         | 
| 62 60 | 
             
                    r << [:attribute, attribute]        
         | 
| 63 | 
            -
                  elsif  | 
| 64 | 
            -
                     | 
| 61 | 
            +
                  elsif /^(?<name>\w+)\/?/ =~ x
         | 
| 62 | 
            +
                    
         | 
| 63 | 
            +
                    x.slice!(/^\w+\/?/)
         | 
| 64 | 
            +
                    r3 = [[:select, name]]
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                    if x.length > 0 then
         | 
| 67 | 
            +
                      functionalise([x], r3) 
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                    end
         | 
| 70 | 
            +
                    r << r3        
         | 
| 71 | 
            +
             | 
| 65 72 | 
             
                  end
         | 
| 66 73 |  | 
| 67 74 | 
             
                end
         | 
| @@ -123,6 +130,7 @@ class RexleXPathParser | |
| 123 130 |  | 
| 124 131 | 
             
                a = []
         | 
| 125 132 |  | 
| 133 | 
            +
                #puts 's: ' + s.inspect
         | 
| 126 134 | 
             
                # e.g. position()
         | 
| 127 135 | 
             
                if /^\w+\(\)$/ =~ s then
         | 
| 128 136 | 
             
                  a << s
         | 
| @@ -145,8 +153,10 @@ class RexleXPathParser | |
| 145 153 | 
             
                  a.concat a2[1..-1]
         | 
| 146 154 |  | 
| 147 155 | 
             
                  a2
         | 
| 148 | 
            -
             | 
| 156 | 
            +
                elsif /^(?<name>\w+)\// =~ s
         | 
| 157 | 
            +
                  a << name <<  match($')
         | 
| 149 158 | 
             
                else
         | 
| 159 | 
            +
             | 
| 150 160 | 
             
                  token = s.slice!(/^[@?\w\/:]+/)
         | 
| 151 161 | 
             
                  a << token
         | 
| 152 162 | 
             
                  remainder = s
         | 
    
        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 | 
            +
              version: 0.1.13
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - James Robertson
         | 
| @@ -31,7 +31,7 @@ cert_chain: | |
| 31 31 | 
             
              adFNS7+S3VVpQqBQ7hIMoNW5ldGHINll6Z0dbjsCO8OFGOkrnzt9ovLffOXuQHpT
         | 
| 32 32 | 
             
              Gpk2If0KQMuV2Q==
         | 
| 33 33 | 
             
              -----END CERTIFICATE-----
         | 
| 34 | 
            -
            date: 2016-05- | 
| 34 | 
            +
            date: 2016-05-26 00:00:00.000000000 Z
         | 
| 35 35 | 
             
            dependencies: []
         | 
| 36 36 | 
             
            description: 
         | 
| 37 37 | 
             
            email: james@r0bertson.co.uk
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |