simple_hl7 1.0.0 → 1.0.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
- data/lib/simple_hl7/subcomponent.rb +18 -11
- data/lib/simple_hl7/version.rb +1 -1
- data/spec/simple_hl7/subcomponent_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0efb8b7549e645da88bd6c6656875bed17d5b411
|
4
|
+
data.tar.gz: 8e835d150c18217dce2d63572a2b2bcd0dcf6c20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8788fe681f3a0d762ee405b225f9fea0c37542f9347d615cfcdf282cddab3c8ec55a52efa8cd7210c20bbf1ddad708b7b97850875fb27598e6a13b5826cacd57
|
7
|
+
data.tar.gz: df1c429e5b62d4f6545ae9a109aca7f6f83675ebc9974736e79f5130445399ce7fef4feea5c55781d02cdbc0f4c030037d05d561e62084806d4a13b600f1208a
|
@@ -7,13 +7,16 @@ module SimpleHL7
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def to_hl7(separator_chars)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
if value.respond_to? :gsub!
|
11
|
+
hl7 = value.gsub(separator_chars.escape, "\\E\\")
|
12
|
+
hl7.gsub!(separator_chars.field, "\\F\\")
|
13
|
+
hl7.gsub!(separator_chars.repetition, "\\R\\")
|
14
|
+
hl7.gsub!(separator_chars.component, "\\S\\")
|
15
|
+
hl7.gsub!(separator_chars.subcomponent, "\\T\\")
|
16
|
+
end
|
16
17
|
hl7
|
18
|
+
rescue => e
|
19
|
+
raise e, "Encountered exception building message: #{e}", e.backtrace
|
17
20
|
end
|
18
21
|
|
19
22
|
def to_s
|
@@ -22,12 +25,16 @@ module SimpleHL7
|
|
22
25
|
|
23
26
|
def self.parse(str, separator_chars)
|
24
27
|
value = str
|
25
|
-
value.gsub!
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
if value.respond_to? :gsub!
|
29
|
+
value.gsub!("\\E\\", separator_chars.escape)
|
30
|
+
value.gsub!("\\F\\", separator_chars.field)
|
31
|
+
value.gsub!("\\R\\", separator_chars.repetition)
|
32
|
+
value.gsub!("\\S\\", separator_chars.component)
|
33
|
+
value.gsub!("\\T\\", separator_chars.subcomponent)
|
34
|
+
end
|
30
35
|
Subcomponent.new(value)
|
36
|
+
rescue => e
|
37
|
+
raise e, "Encountered exception parsing message: #{e}", e.backtrace
|
31
38
|
end
|
32
39
|
end
|
33
40
|
end
|
data/lib/simple_hl7/version.rb
CHANGED
@@ -30,6 +30,12 @@ module SimpleHL7
|
|
30
30
|
subc.to_hl7(default_chars).should == "\\E\\\\T\\\\S\\\\R\\\\F\\"
|
31
31
|
end
|
32
32
|
|
33
|
+
it "doesn't mutate the subcomponent" do
|
34
|
+
subc = Subcomponent.new('peas&carrots')
|
35
|
+
subc.to_hl7(SeparatorCharacters.defaults)
|
36
|
+
subc.value.should == 'peas&carrots'
|
37
|
+
end
|
38
|
+
|
33
39
|
context "when initialized with an empty string" do
|
34
40
|
it "returns an empty string" do
|
35
41
|
subc = Subcomponent.new(nil)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_hl7
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rome Portlock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|