rexle 1.2.9 → 1.2.10

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: 77b1f961f21a086af4b24a1462048089ca8267a7
4
- data.tar.gz: bcd0ebb6200230227939e647bc1196d3160e49bb
3
+ metadata.gz: 357f8b7df88a90b74139dae305506bea4fc60484
4
+ data.tar.gz: ed9fe8a06e4ef7dea9b85783b82da30bde2b648c
5
5
  SHA512:
6
- metadata.gz: c0dc025274b899cffb1d8e33fae29ce96f95561f1d94ab959b6995b1fbf4478d588933aef747c95df33e63719c7a6fceff6d5e8884149be3068ad6039ae4d74d
7
- data.tar.gz: 56c6338919840b9ede0a74553f3c9d0b8712932864c73ff5bb8f3c7f5ea8a9feb9b6e428140039ca15542af7dc696b7f303ce3d68a45f396633d86aa30eed043
6
+ metadata.gz: 30b7b83180b6da2d9e68e266fcb7142607b74ae8590df652d4fa6a8980e48320db0fe8d37d61a0d2892487bfffe92ec0457d206e07eea23767d61ebeaab22029
7
+ data.tar.gz: 1c457f03cb94a6e16e6cdbd9b7a94685190b9075e2d2bb9a7c6162c99b07722b5635df05ad2603f26e54eea8965ccf5c31c6eac21bc0d47e7f8f0ea2359ee455
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/rexle.rb CHANGED
@@ -11,6 +11,8 @@ require 'cgi'
11
11
 
12
12
  # modifications:
13
13
 
14
+ # 07-Feb-2015: Implemented XPath function last() e.g.
15
+ # doc.root.xpath('records/item[last()]')
14
16
  # 05-Feb=2015: bug fix:
15
17
  # Rexle::Element#texts now transforms all items to a String
16
18
  # 04-Feb-2015: An xpath containing text() now calls texts() to
@@ -411,12 +413,17 @@ class Rexle
411
413
  end
412
414
 
413
415
  def filter_xpath(path, rlist=[], &blk)
414
-
416
+
415
417
  # is it a function
416
418
  fn_match = path.match(/^(\w+)\(["']?([^\)]*)["']?\)(?:\[(.*)\])?$/)
419
+ end_fn_match = path.slice!(/\[\w+\(\)\]$/)
420
+
421
+ if end_fn_match then
422
+
423
+ m = end_fn_match[1..-4]
424
+ [method(m.to_sym).call(xpath path)]
417
425
 
418
- # Array: proc {|x| x.flatten.compact},
419
- if (fn_match and fn_match.captures.first[/^(attribute|@)/]) or fn_match.nil? then
426
+ elsif (fn_match and fn_match.captures.first[/^(attribute|@)/]) or fn_match.nil? then
420
427
 
421
428
  procs = {
422
429
  #jr061012 Array: proc {|x| block_given? ? x : x.flatten.uniq },
@@ -442,7 +449,7 @@ class Rexle
442
449
 
443
450
  results = raw_results
444
451
 
445
- procs[results.class.to_s.to_sym].call(results) if results
452
+ procs[results.class.to_s.to_sym].call(results) if results
446
453
 
447
454
  else
448
455
 
@@ -808,6 +815,7 @@ class Rexle
808
815
  def has_elements?() !self.elements.empty? end
809
816
  def insert_after(node) insert(node, 1) end
810
817
  def insert_before(node) insert(node) end
818
+ def last(a) a.last end
811
819
  def map(&blk) self.children.map(&blk) end
812
820
  def root() self end
813
821
 
data.tar.gz.sig CHANGED
Binary file
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.2.9
4
+ version: 1.2.10
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: 2015-02-05 00:00:00.000000000 Z
34
+ date: 2015-02-07 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rexleparser
metadata.gz.sig CHANGED
Binary file