rexslt 0.4.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/rexslt.rb +26 -22
  5. metadata +10 -10
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95e290c2a89c244bf699efa66861541d7dd3c8b2
4
- data.tar.gz: ea41c03ab0ff57e6593c1f01fa3f4de90246ae32
3
+ metadata.gz: 1e5cb3fb23bdbadadbc09927caf8290a487024ba
4
+ data.tar.gz: c106d6397abf4421c4585edeb08731672024bc22
5
5
  SHA512:
6
- metadata.gz: 189af495ea0713480685d0e656f6cf9d4ec104f65c30276f4586da9c28e63794223616bbc2fc1a70cdba624b9e20a310a6af939b3e74a32e7b2168e9bdbb77f9
7
- data.tar.gz: 895a8fc44f217954077d99a0658434e89ac477cf073930c340f5a910715fc517d12728352d366a4c66b65178d8f8277dd89540a1abfbbf23e606f39c01413bbb
6
+ metadata.gz: 2413e53b29a3dad2412d64fb7fb2a83780b9ae462a29ead1802fec907580d7db83618e03d99ff361192d4de28f35e7799207196945352aa28a0790afe8e725aa
7
+ data.tar.gz: 61c384317e59acdcedabd667fd806cd380b229b5b73b85468b8abfc90550fe0236241da8a6c8881cb3ad1875a403a77f6f072a862b6f2547ba456b91cc15c729
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -6,32 +6,37 @@ require 'rexle'
6
6
  require 'rxfhelper'
7
7
 
8
8
 
9
- class Rexle::Element
10
- def to_xpath(option=nil)
11
- def attribute_scan(node)
12
- result = ''
13
- attr = %w(id class).detect {|x| node.attributes.has_key? x}
14
- if attr then
15
- value = node.attribute[attr]
16
- result = "[@%s='%s']" % [attr, value]
9
+ module RexPath
10
+
11
+ refine Rexle::Element do
12
+
13
+ def to_xpath(option=nil)
14
+ def attribute_scan(node)
15
+ result = ''
16
+ attr = %w(id class).detect {|x| node.attributes.has_key? x}
17
+ if attr then
18
+ value = node.attribute[attr]
19
+ result = "[@%s='%s']" % [attr, value]
20
+ end
21
+ result
17
22
  end
18
- result
19
- end
20
23
 
21
- def doc_scan(node, option=nil)
22
- name = node.name
23
- attribute = option == :no_cond ? '' : attribute_scan(node)
24
- result = doc_scan(node.parent,option) unless node.root === node.doc_root
25
- [result, name.to_s + attribute]
26
- end
24
+ def doc_scan(node, option=nil)
25
+ name = node.name
26
+ attribute = option == :no_cond ? '' : attribute_scan(node)
27
+ result = doc_scan(node.parent,option) unless node.root === node.doc_root
28
+ [result, name.to_s + attribute]
29
+ end
27
30
 
28
- doc_scan(self, option).flatten.compact.join('/')
31
+ doc_scan(self, option).flatten.compact.join('/')
32
+ end
29
33
  end
30
34
  end
31
35
 
32
36
 
33
37
  class Rexslt
34
-
38
+ using RexPath
39
+
35
40
  def initialize(xsl, xml, params={})
36
41
  super()
37
42
  custom_params = params.inject({}){|r,x| r.merge(Hash[x[0].to_s,x[1]])}
@@ -324,7 +329,6 @@ class Rexslt
324
329
  end
325
330
 
326
331
  #doc_element.add_text x if x.is_a? String
327
- #puts '300 doc_element: ' + doc_element.inspect
328
332
 
329
333
  end
330
334
 
@@ -422,9 +426,9 @@ class Rexslt
422
426
 
423
427
  def xslt_transform(raw_xsl, xml, custom_params={})
424
428
 
425
- doc_xml = Rexle.new xml
426
-
427
- @doc_xsl = Rexle.new raw_xsl
429
+ doc_xml = xml.is_a?(Rexle) ? xml : Rexle.new(xml)
430
+
431
+ @doc_xsl = raw_xsl.is_a?(Rexle) ? raw_xsl : Rexle.new(raw_xsl)
428
432
 
429
433
  filter_out_spaces @doc_xsl.root
430
434
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexslt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  38j2+6ULVWalsVein3whb7qB6IOvxoSqjz6n7jAKFGHovoXPUqpv5y5Yor23rTrn
32
32
  0YwisIc3UkL30g==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-03-05 00:00:00.000000000 Z
34
+ date: 2016-03-10 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rxfhelper
@@ -39,40 +39,40 @@ dependencies:
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '0.1'
42
+ version: '0.2'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 0.1.12
45
+ version: 0.2.3
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: '0.1'
52
+ version: '0.2'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 0.1.12
55
+ version: 0.2.3
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rexle
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '1.0'
62
+ version: '1.3'
63
63
  - - ">="
64
64
  - !ruby/object:Gem::Version
65
- version: 1.0.11
65
+ version: 1.3.11
66
66
  type: :runtime
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
70
  - - "~>"
71
71
  - !ruby/object:Gem::Version
72
- version: '1.0'
72
+ version: '1.3'
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 1.0.11
75
+ version: 1.3.11
76
76
  description:
77
77
  email: james@r0bertson.co.uk
78
78
  executables: []
metadata.gz.sig CHANGED
Binary file