rx_sliml 0.2.0 → 0.2.1
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/rx_sliml.rb +22 -5
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 409e781c8b7b5b538cc1ee0225bd3b609e2bd9007a9b7310e11ba728c8cbb430
|
4
|
+
data.tar.gz: db7558b934c4dbdac2c3b0bafa57ec2b99fc1100b6902d3b81d4c6939d0090df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcc428f429bc0e0f6cafb0be06c1ff896864e9eae9b3e33020a7bde0032b362ef0fd44fa2f75f6c80e520aa9c76d79d62c75aa43d08e28ddecdbae18dd61767e
|
7
|
+
data.tar.gz: 7c6ac30d13c7abd7436fb50455e791e2001f63fe078c6cf7bb5759210f02d3583910c9af2ae95899c80fc3dac3cb40233f9969b57f6b9c109ad59eeb1f9f9b31
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rx_sliml.rb
CHANGED
@@ -7,16 +7,33 @@ require 'rexle-builder'
|
|
7
7
|
require 'nokogiri'
|
8
8
|
|
9
9
|
|
10
|
+
class RxSlimlException < Exception
|
11
|
+
end
|
12
|
+
|
10
13
|
class RxSliml
|
11
14
|
|
12
15
|
attr_reader :to_xslt, :to_html
|
13
16
|
|
14
|
-
def initialize(sliml=nil,
|
17
|
+
def initialize(sliml=nil, obj=nil, fields: nil)
|
15
18
|
|
16
|
-
|
19
|
+
# assumes the obj is either a Kvx object or responds to :to_kvx
|
20
|
+
#
|
21
|
+
@rx = if obj then
|
22
|
+
|
23
|
+
if obj.is_a? Kvx then
|
24
|
+
obj
|
25
|
+
elsif obj.respond_to? :to_kvx
|
26
|
+
obj.to_kvx
|
27
|
+
elsif obj.respond_to? :to_xml
|
28
|
+
obj
|
29
|
+
else
|
30
|
+
raise RxSlimlException, 'reference object not recognised'
|
31
|
+
end
|
32
|
+
end
|
17
33
|
|
18
34
|
if sliml.nil? and fields.nil? then
|
19
|
-
raise 'RxSliml: please enter a sliml string or
|
35
|
+
raise RxSlimlException, 'RxSliml: please enter a sliml string or ' +
|
36
|
+
'an array of fields'
|
20
37
|
end
|
21
38
|
|
22
39
|
sliml ||= create_sliml(fields)
|
@@ -33,7 +50,7 @@ class RxSliml
|
|
33
50
|
@to_xslt = build_xslt
|
34
51
|
|
35
52
|
xslt = Nokogiri::XSLT(@to_xslt)
|
36
|
-
@to_html = xslt.transform(Nokogiri::XML(@rx.to_xml)) if rx
|
53
|
+
@to_html = xslt.transform(Nokogiri::XML(@rx.to_xml)) if @rx
|
37
54
|
|
38
55
|
end
|
39
56
|
|
@@ -111,4 +128,4 @@ class RxSliml
|
|
111
128
|
|
112
129
|
end
|
113
130
|
|
114
|
-
end
|
131
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rx_sliml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
k8AGLEdGamYYeNF1PX6Q8n1k34S0m5Ty0Jns92XI3ohbcdH9LFweWw4i1qCFqQC8
|
36
36
|
cz+lZHiCYH6ZIHv/0vgLU2Tx
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2021-02-
|
38
|
+
date: 2021-02-21 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: nokogiri
|
metadata.gz.sig
CHANGED
Binary file
|