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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b86fbf729318a11892a84b45266a3b327a23ce2c
4
- data.tar.gz: 446273020981a059aacbcb137e154d348db65f5a
3
+ metadata.gz: 0efb8b7549e645da88bd6c6656875bed17d5b411
4
+ data.tar.gz: 8e835d150c18217dce2d63572a2b2bcd0dcf6c20
5
5
  SHA512:
6
- metadata.gz: 3d7dde564de84aad240f7a02bdd7e68179a4b63782525d5ddee005b0e74b2377f03d976bd3a63c18d84a0ebae9fff1fa7bd4690b4ffdf69f6cf320942a33bad4
7
- data.tar.gz: a32a050e3b24e5dea6e0b6ba3c3a201c859e78147e1eae9b0e9cdcdee350983d7635a6d860ca1865dec3d548501c81744b57edd123ecb80639224f05028e0250
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
- hl7 = value
11
- hl7.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\\")
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!("\\E\\", separator_chars.escape)
26
- value.gsub!("\\F\\", separator_chars.field)
27
- value.gsub!("\\R\\", separator_chars.repetition)
28
- value.gsub!("\\S\\", separator_chars.component)
29
- value.gsub!("\\T\\", separator_chars.subcomponent)
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
@@ -1,3 +1,3 @@
1
1
  module SimpleHL7
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -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.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-02-14 00:00:00.000000000 Z
11
+ date: 2016-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry