rexle 1.3.30 → 1.3.31

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: 17b270997c2599c0283eea0a908245ef872bf119
4
- data.tar.gz: df441bb368b681bac74196af5c95d98500d1a58c
3
+ metadata.gz: c70918a9a9fcc6f391f61bcaf5487eb47279b742
4
+ data.tar.gz: 6a46404468b391f7cc53c666ffa903343b25bb4f
5
5
  SHA512:
6
- metadata.gz: d5c227c2b77bb9e9cd0484bdd9386823102509b177b967adb3444e62c1b0b9949500c85c951e182dff193896ec9fc0734b0e155f2a2eb844e25d63a52ef458e8
7
- data.tar.gz: fa321760606e37223f2facd16b56064ece823d4dabaccd2ea8107643a3ad62d28d4d8200816f186012f66a4d7f7a4d84874b4c5002c7246be8b2b8c8c3ea2191
6
+ metadata.gz: 2c9b4b0764b8493b06b57448b5321c10fa7b586129f634ca26fb0387800eb23072ada5b103b3af9ae8024b758edcc23a6547810780197d986f93f3a384e5a9d2
7
+ data.tar.gz: 018db7a1dee71d94cb616d9650c46163140f82ff3d89720a19a35e9be2d55899ec6d84364911e545d8b36f105e9a3f485ede41e27cbc9b3140595b2a11cdacd9
checksums.yaml.gz.sig CHANGED
@@ -1 +1,3 @@
1
- ���d_��.BP�q1�C���v|*s8kDp���b���N~�����5o�˚A�bO&��!�]�������B��QuE��N���v)_6 rHI���9SxP��K!�T+��Qgap3��
1
+ "�`�~�%�a��^ �����o��$ ~�Q6I[�Ue@�Y��(��@������*X%?fB����!�UY�����m �e`_��N�Z����{zv-A�  ����Y׆o�$y���mDOId��3H\�xG =Wt���
2
+ �� oSd�=g;������e�$�h?�e���[ v�����q���� W��䉑jd
3
+ W�@N�e]Q8�@�5s���u���I�W�}���E��N�-��18L
data.tar.gz.sig CHANGED
Binary file
data/lib/rexle.rb CHANGED
@@ -12,6 +12,9 @@ require 'backtrack-xpath'
12
12
 
13
13
  # modifications:
14
14
 
15
+ # 06-May-2016: feature: Rexle::Element.text now returns a
16
+ # Rexle::Element::Value object which is a kind of
17
+ # String which be used for comparing numbers
15
18
  # 25-Apr-2016: bug fix: Rexle::Element#to_a no longer returns a
16
19
  # duplicate text value
17
20
  # 24-Apr-2016: bug fix: The element text is now enclosed within quotes when
@@ -308,6 +311,21 @@ class Rexle
308
311
  class Element
309
312
  include XMLhelper
310
313
 
314
+ class Value < String
315
+
316
+ def initialize(value)
317
+ super(value)
318
+ end
319
+
320
+ def <(val2)
321
+ self.to_f < val2.to_f
322
+ end
323
+
324
+ def >(val2)
325
+ self.to_f > val2.to_f
326
+ end
327
+ end
328
+
311
329
  attr_accessor :name, :value, :parent
312
330
  attr_reader :child_elements, :doc_id, :instructions
313
331
 
@@ -401,7 +419,7 @@ class Rexle
401
419
 
402
420
  alias next_sibling next_element
403
421
 
404
- def notx(bool)
422
+ def not(bool)
405
423
 
406
424
  r = self.xpath(bool).any?
407
425
 
@@ -443,6 +461,7 @@ class Rexle
443
461
 
444
462
  # is it a function
445
463
  fn_match = path.match(/^(\w+)\(["']?([^\)]*)["']?\)(?:\[(.*)\])?$/)
464
+ #fn_match = path.match(/^(\w+)\(/)
446
465
  #@log.debug 'fn_match : ' + fn_match.inspect
447
466
  end_fn_match = path.slice!(/\[\w+\(\)\]$/)
448
467
 
@@ -609,6 +628,7 @@ class Rexle
609
628
  else
610
629
  condition = element_part
611
630
  attr_search = format_condition('[' + condition + ']')
631
+
612
632
  #@log.debug 'attr_search : ' + attr_search.inspect
613
633
  return [attribute_search(attr_search, \
614
634
  self, self.attributes) != nil]
@@ -623,6 +643,7 @@ class Rexle
623
643
 
624
644
  attr_search = format_condition(condition) if condition \
625
645
  and condition.length > 0
646
+
626
647
  #@log.debug 'attr_search2 : ' + attr_search.inspect
627
648
  attr_search2 = xpath_value[/^\[(.*)\]$/,1]
628
649
 
@@ -672,11 +693,12 @@ class Rexle
672
693
  elsif ename == '.'
673
694
 
674
695
  remaining_xpath = raw_path[1..-1]
696
+
675
697
  return remaining_xpath.empty? ? self : self.xpath(remaining_xpath)
676
698
  elsif element_name.nil?
677
699
  return eval attr_search
678
700
  else
679
-
701
+
680
702
  if raw_selector.nil? and ename != element_part then
681
703
 
682
704
  right_cond = element_part[/#{ename}(.*)/,1]
@@ -806,7 +828,7 @@ class Rexle
806
828
  def add_element(item)
807
829
 
808
830
  if item.is_a? String then
809
- @child_elements << String.new(item)
831
+ @child_elements << Value.new(item)
810
832
 
811
833
  elsif item.is_a? Rexle::CData then
812
834
  @child_elements << item
@@ -954,6 +976,12 @@ class Rexle
954
976
  def last(a) a.last end
955
977
  def map(&blk) self.children.map(&blk) end
956
978
  def root() self end
979
+
980
+ # Reserved for future use in Rexle 2.0
981
+ #
982
+ def select(name)
983
+ elements.select {|x| x.name == name}
984
+ end
957
985
 
958
986
  def text(s='')
959
987
 
@@ -998,7 +1026,7 @@ class Rexle
998
1026
 
999
1027
  def value=(raw_s)
1000
1028
 
1001
- val = String.new(raw_s.to_s.clone)
1029
+ val = Value.new(raw_s.to_s.clone)
1002
1030
 
1003
1031
  escape_chars = %w(& &amp; < &lt; > &gt;).each_slice(2).to_a
1004
1032
  escape_chars.each{|x| val.gsub!(*x)}
@@ -1065,7 +1093,7 @@ class Rexle
1065
1093
  def format_condition(condition)
1066
1094
 
1067
1095
  raw_items = condition.sub(/\[(.*)\]/,'\1').scan(/\'[^\']*\'|\"[^\"]*\"|\
1068
- and|or|\d+|[!=<>%]+|position\(\)|contains\([^\)]+\)|notx\([^\)]+\)|[@\w\.\/&;]+/)
1096
+ and|or|\d+|[!=<>%]+|position\(\)|contains\([^\)]+\)|not\([^\)]+\)|[@\w\.\/&;]+/)
1069
1097
 
1070
1098
  if raw_items[0][/^\d+$/] then
1071
1099
 
@@ -1082,7 +1110,8 @@ class Rexle
1082
1110
  return rrr
1083
1111
  elsif raw_items[0][/^contains\(/]
1084
1112
  return raw_items[0]
1085
- elsif raw_items[0][/^notx\(/]
1113
+ elsif raw_items[0][/^not\(/]
1114
+
1086
1115
  return raw_items[0]
1087
1116
  else
1088
1117
 
@@ -1143,7 +1172,7 @@ class Rexle
1143
1172
  x
1144
1173
  end
1145
1174
  end
1146
-
1175
+
1147
1176
  return items.join(' ')
1148
1177
  end
1149
1178
  end
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.3.30
4
+ version: 1.3.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  pOw2Fx4uv9tO6wagRTcaHduxkh4jYfPDQI9mODFccHeY+wRLDGTENQwIILvMgEa7
32
32
  50vRuyU+obGfjg==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-04-25 00:00:00.000000000 Z
34
+ date: 2016-05-06 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rexleparser
metadata.gz.sig CHANGED
Binary file