rexle 1.3.32 → 1.3.33

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: 82fcd328197c1d282c442001e905a24269c41978
4
- data.tar.gz: 208fb18b0f81b218f4275b683c756573a757e7fe
3
+ metadata.gz: 5899147c749d52b55c59a05f23362124f8bf5329
4
+ data.tar.gz: 3892313cc7233de726f0af7d2913349c23940142
5
5
  SHA512:
6
- metadata.gz: 33cc6131670d86d2a68cbecf30181b7814c98a15f64de398e91b33cf4338a4c2ca466e06bdafead1483aad2f30af02515f7c3e1597bcb57af316acf68961b425
7
- data.tar.gz: d2e97f350be6b99d35d02f61b4d0f3e8486b270e7f8df2e5c7f11f0abd50fc43374a42119c3680877a659f79b2f7568c79a01db396b081ab190e006f26ebed07
6
+ metadata.gz: bd74fa531c3b64e3a69af97d4537e4165a1611ff54c6891922b9b9b4a6dcd59874a5c9295df8228c97b164878db29363f960237f4f9b27742efce0863537200c
7
+ data.tar.gz: ca34918f9e079187d46548c96f55bd12acdef54498e44cab10138bcfb13787a840729fe7f57c4c072dffdd90d93c62501458e19177d090a11fa398a130616c9c
checksums.yaml.gz.sig CHANGED
@@ -1 +1 @@
1
- ���/��r[ֳ�Cynx�����\�pm��w�EA��C���h]�rg����S�#����Wl�:md���]<�1� �z���@U���?o��w��� "eAZ1�d)HiW�w��) �F��9�X��.�2���''�];+�;m|�\�N{�q���~^��f:�R�2å3 }�q�d���h����d����e�:6_�M��N���� =��&����u�:#��\���,KH9�;�U�����k}�I�
1
+ ,�&�њ�exaS�|J0 K ]���o)�������+$œ�P'2͹�����C&���S����� |�����2���+�M��=�ʱw��TVӹ�@<�i[���Ù�o��4���zh�+�
data.tar.gz.sig CHANGED
Binary file
data/lib/rexle.rb CHANGED
@@ -12,6 +12,8 @@ require 'backtrack-xpath'
12
12
 
13
13
  # modifications:
14
14
 
15
+ # 21-May-2016: design fix: When an attribute is specified within an XPath, a
16
+ # Rexle::Element::Attribute object is now returned
15
17
  # 15-May-2016: bug fix: Rexle::Element::add_attribute can now handle the
16
18
  # object Attribute::Value
17
19
  # 06-May-2016: feature: Rexle::Element.text now returns a
@@ -297,7 +299,27 @@ class Rexle
297
299
  def >(val2)
298
300
  self.to_f > val2.to_f
299
301
  end
300
- end
302
+ end
303
+
304
+ class Attribute
305
+
306
+ attr_reader :value
307
+
308
+ def initialize(value)
309
+ @value = value
310
+ end
311
+
312
+ def to_f()
313
+ @value.to_f
314
+ end
315
+
316
+ def to_i()
317
+ @value.to_i
318
+ end
319
+
320
+ alias to_s value
321
+
322
+ end
301
323
 
302
324
  attr_accessor :name, :value, :parent
303
325
  attr_reader :child_elements, :doc_id, :instructions
@@ -360,7 +382,7 @@ class Rexle
360
382
  end
361
383
 
362
384
  def max(path)
363
- a = query_xpath(path).flatten.select{|x| x.is_a? String}.map(&:to_i)
385
+ a = query_xpath(path).flatten.select{|x| x.is_a? String or x.is_a? Rexle::Element::Attribute}.map(&:to_i)
364
386
  a.max
365
387
  end
366
388
 
@@ -571,7 +593,7 @@ class Rexle
571
593
  attribute = xpath_value[/^(attribute::|@)(.*)/,2]
572
594
 
573
595
  return @attributes if attribute == '*'
574
- return [@attributes[attribute.to_sym]] if attribute \
596
+ return [Attribute.new(@attributes[attribute.to_sym])] if attribute \
575
597
  and @attributes and @attributes.has_key?(attribute.to_sym)
576
598
  s = a_path.shift
577
599
  end
@@ -1135,7 +1157,7 @@ class Rexle
1135
1157
  path, value = x.values_at(0,-1)
1136
1158
 
1137
1159
  if x[0][/@\w+$/] then
1138
- "r = e.xpath('#{path}').first; r and r == #{value}"
1160
+ "r = e.xpath('#{path}').first; r and r.value == #{value}"
1139
1161
  else
1140
1162
  "r = e.xpath('#{path}').first; r and r.value == #{value}"
1141
1163
  end
@@ -1213,7 +1235,7 @@ class Rexle
1213
1235
  end
1214
1236
 
1215
1237
  def attribute_search(attr_search, e, h, i=nil, &blk)
1216
-
1238
+
1217
1239
  r2 = if attr_search.is_a? Fixnum then
1218
1240
  block_given? ? blk.call(e) : e if i == attr_search
1219
1241
  elsif attr_search[/i\s(?:<|>|==|%)\s\d+/] and eval(attr_search) then
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.32
4
+ version: 1.3.33
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-05-15 00:00:00.000000000 Z
34
+ date: 2016-05-21 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rexleparser
metadata.gz.sig CHANGED
Binary file