Class: HealthcarePhony::Adt
- Inherits:
-
Object
- Object
- HealthcarePhony::Adt
- Defined in:
- lib/healthcare_phony.rb
Instance Attribute Summary collapse
-
#adt_arguments ⇒ Object
readonly
Returns the value of attribute adt_arguments.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize(**init_args) ⇒ Adt
constructor
A new instance of Adt.
- #to_s ⇒ Object
Constructor Details
#initialize(**init_args) ⇒ Adt
Returns a new instance of Adt.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/healthcare_phony.rb', line 16 def initialize(**init_args) @adt_arguments = init_args @adt_arguments[:message_types] = 'ADT' unless adt_arguments[:template].nil? @template = adt_arguments[:template] return end @template = if adt_arguments[:template_file].nil? File.read(File.join(File.dirname(__FILE__), 'healthcare_phony', 'templates', 'adt_example.erb')) else File.read(adt_arguments[:template_file]) end end |
Instance Attribute Details
#adt_arguments ⇒ Object (readonly)
Returns the value of attribute adt_arguments.
14 15 16 |
# File 'lib/healthcare_phony.rb', line 14 def adt_arguments @adt_arguments end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
14 15 16 |
# File 'lib/healthcare_phony.rb', line 14 def template @template end |
Instance Method Details
#to_s ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/healthcare_phony.rb', line 30 def to_s template = ERB.new(@template) = Hl7Message.new(@adt_arguments) patient = Patient.new(@adt_arguments) visit = PatientVisit.new(@adt_arguments) template.result_with_hash({ patient: patient, hl7: , visit: visit }) end |