Class: Renalware::Transplants::CreateDonorStage
- Inherits:
-
Object
- Object
- Renalware::Transplants::CreateDonorStage
- Defined in:
- app/models/renalware/transplants/create_donor_stage.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(patient:, options: {}) ⇒ CreateDonorStage
constructor
A new instance of CreateDonorStage.
Constructor Details
#initialize(patient:, options: {}) ⇒ CreateDonorStage
Returns a new instance of CreateDonorStage.
12 13 14 15 |
# File 'app/models/renalware/transplants/create_donor_stage.rb', line 12 def initialize(patient:, options: {}) @patient = patient @options = end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/renalware/transplants/create_donor_stage.rb', line 17 def call DonorStage.transaction do terminate_current_stage if current_stage.present? stage = build_new_stage if stage.save ::Renalware::Success.new(stage) else ::Renalware::Failure.new(stage) end end end |