ruby_astm 1.0.9 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c41f5303f7e4e0c2897d7c4407df2fe85594f98313e54bed535375b6113cb62
4
- data.tar.gz: 1edc251af06f231faf23d792aa487d0b6a1c6a11054e00e892373bede46b23df
3
+ metadata.gz: b5aad9b688056b23b5252d954ec6f6e53d11decab2e5adbd33251613642f5ee0
4
+ data.tar.gz: 1b9b7cac6d3122b4cd62a36611a05226254453a124788078ba51ab0ea03f22fd
5
5
  SHA512:
6
- metadata.gz: 3558047e44fb12208c4509655848cd01b0e1bfe850202d68d2d7d174ef6738d3bfada4c0a8683adffb2d33e611b7a1d3329c2f29c537de4ca3c6a27fed735962
7
- data.tar.gz: 10228f02a0b2b8fa87f4e0de2f56159ea73ef3e7e3dcafe556e51163bdd71c9991531c40d7a1b96875b38c0b2387f8f8540133f34a0364530cc265a33f82b2b8
6
+ metadata.gz: 8ca884192d09d41a0982012a22fd79a832f7737697f1b182ba125e28cfc4a194c4908a62d7e5eae127e4acfa6bdf248a3012d26a5d557fcacdb083625bd1fad2
7
+ data.tar.gz: 6e1896e259496d069a9aa86e255a38b70c119b4460b3e875958360bbcfc013a86dd88aed79a2a78192c729fad14de321794573bdf4008fe5b0e58a4eaee89fdf
@@ -10,13 +10,18 @@ module LabInterface
10
10
  ETX = "\x03"
11
11
  EOT = "\x04"
12
12
 
13
+
14
+
13
15
  mattr_accessor :headers
14
16
  mattr_accessor :ethernet_server
15
17
  mattr_accessor :server_ip
16
18
  mattr_accessor :server_port
17
19
  mattr_accessor :mapping
18
20
  mattr_accessor :respond_to_queries
19
-
21
+
22
+ ## buffer of incoming data.
23
+ mattr_accessor :data_buffer
24
+
20
25
 
21
26
  ## returns the root directory of the gem.
22
27
  def root
@@ -56,7 +61,9 @@ module LabInterface
56
61
 
57
62
  def receive_data(data)
58
63
 
59
- puts "incoming data bytes."
64
+ self.data_buffer ||= ''
65
+
66
+ #puts "incoming data bytes."
60
67
 
61
68
  concat = ""
62
69
 
@@ -77,10 +84,20 @@ module LabInterface
77
84
  end
78
85
 
79
86
  #puts "concat is:"
87
+
80
88
  #puts concat.to_s
81
- process_text(concat)
82
89
 
83
- if data.bytes.to_a[0] == 4
90
+ self.data_buffer << concat
91
+
92
+ ## if the last byte is EOT, then call process text.
93
+ ## inside that split by line and process one at a time.
94
+ ##process_text(concat)
95
+
96
+
97
+ if data.bytes.to_a[-1] == 4
98
+ puts self.data_buffer
99
+ process_text(self.data_buffer)
100
+ self.data_buffer = ''
84
101
  send_data(ENQ)
85
102
  elsif data.bytes.to_a[0] == 6
86
103
  self.headers[-1].build_responses.each do |response|
@@ -99,7 +116,7 @@ module LabInterface
99
116
  end
100
117
  else
101
118
  ## send the header
102
- puts "--------- SENT ACK -----------"
119
+ #puts "--------- SENT ACK -----------"
103
120
  if self.headers.blank?
104
121
  send_data(ACK)
105
122
  else
@@ -123,8 +140,6 @@ module LabInterface
123
140
  end
124
141
 
125
142
  def process_text(text)
126
- ## should replace carriage returns with new lines, before processing any file.
127
- ## or text.
128
143
  text.split("\n").each do |l|
129
144
  line = Line.new({:text => l})
130
145
  process_type(line)
@@ -36,13 +36,13 @@ class Order
36
36
 
37
37
  def set_id(args)
38
38
  if line = args[:line]
39
- if !line.fields[2].strip.blank?
39
+ if !line.fields[2].blank?
40
40
  line.fields[2].strip.scan(/(?<specimen_id>[^\^]+)/) { |specimen_id|
41
- self.id ||= specimen_id
41
+ self.id ||= specimen_id[0]
42
42
  }
43
- elsif !line.fields[3].strip.blank?
43
+ elsif !line.fields[3].blank?
44
44
  ## for the sysmex xn-550 this is the regex.
45
- line.fields[3].strip.scan(/(?<tube_rack>\d+\^)+(?<patient_id>.+)\^/) { |tube_rack,patient_id| self.id = patient_id.strip}
45
+ line.fields[3].strip.scan(/(?<tube_rack>\d+\^)+(?<patient_id>.+)\^/) { |tube_rack,patient_id| self.id = patient_id.strip}
46
46
  end
47
47
  else
48
48
  self.id = args[:specimen_id]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_astm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bhargav Raut