Class: Patient
- Inherits:
-
Object
- Object
- Patient
- Defined in:
- lib/ruby_astm/patient.rb
Instance Attribute Summary collapse
-
#orders ⇒ Object
Returns the value of attribute orders.
-
#patient_id ⇒ Object
Returns the value of attribute patient_id.
-
#sequence_number ⇒ Object
sequence number can only be from 0 – 9.
Instance Method Summary collapse
-
#build_response ⇒ Object
patient id.
-
#initialize(args) ⇒ Patient
constructor
A new instance of Patient.
- #to_json ⇒ Object
Constructor Details
#initialize(args) ⇒ Patient
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ruby_astm/patient.rb', line 8 def initialize(args) if args[:line] line = args[:line] self.sequence_number = line.fields[1].to_i self.orders = [] else self.sequence_number = args[:sequence_number] self.patient_id = args[:patient_id] end end |
Instance Attribute Details
#orders ⇒ Object
Returns the value of attribute orders.
6 7 8 |
# File 'lib/ruby_astm/patient.rb', line 6 def orders @orders end |
#patient_id ⇒ Object
Returns the value of attribute patient_id.
5 6 7 |
# File 'lib/ruby_astm/patient.rb', line 5 def patient_id @patient_id end |
#sequence_number ⇒ Object
sequence number can only be from 0 – 9.
4 5 6 |
# File 'lib/ruby_astm/patient.rb', line 4 def sequence_number @sequence_number end |
Instance Method Details
#build_response ⇒ Object
patient id.
20 21 22 |
# File 'lib/ruby_astm/patient.rb', line 20 def build_response "P|#{self.sequence_number}|#{self.patient_id}|||||||||||||||\r" end |
#to_json ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/ruby_astm/patient.rb', line 24 def to_json hash = {} self.instance_variables.each do |x| hash[x] = self.instance_variable_get x end return hash.to_json end |