Class: Renalware::Medications::TerminateAllPatientPrescriptions
- Inherits:
-
Object
- Object
- Renalware::Medications::TerminateAllPatientPrescriptions
- Defined in:
- app/models/renalware/medications/terminate_all_patient_prescriptions.rb
Instance Attribute Summary collapse
-
#by ⇒ Object
readonly
Returns the value of attribute by.
-
#patient ⇒ Object
readonly
Returns the value of attribute patient.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(patient, by) ⇒ TerminateAllPatientPrescriptions
constructor
A new instance of TerminateAllPatientPrescriptions.
Constructor Details
#initialize(patient, by) ⇒ TerminateAllPatientPrescriptions
Returns a new instance of TerminateAllPatientPrescriptions.
14 15 16 17 |
# File 'app/models/renalware/medications/terminate_all_patient_prescriptions.rb', line 14 def initialize(patient, by) @patient = patient @by = by end |
Instance Attribute Details
#by ⇒ Object (readonly)
Returns the value of attribute by.
8 9 10 |
# File 'app/models/renalware/medications/terminate_all_patient_prescriptions.rb', line 8 def by @by end |
#patient ⇒ Object (readonly)
Returns the value of attribute patient.
8 9 10 |
# File 'app/models/renalware/medications/terminate_all_patient_prescriptions.rb', line 8 def patient @patient end |
Class Method Details
.call(patient:, by:) ⇒ Object
10 11 12 |
# File 'app/models/renalware/medications/terminate_all_patient_prescriptions.rb', line 10 def self.call(patient:, by:) new(patient, by).call end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 |
# File 'app/models/renalware/medications/terminate_all_patient_prescriptions.rb', line 19 def call patient.prescriptions.current.each do |prescription| prescription.terminate(by: by).save! end end |