Class: Renalware::HD::ModalityDescription::AugmentedModalityName

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/hd/modality_description.rb

Overview

This class might be better as a presenter but leaving here for now. #to_s returns e.g. “HD (HOSPCODE)” if patient’s HD profile indicates they dialyse at HOSPCODE, otherwise returns “HD”.

Instance Method Summary collapse

Constructor Details

#initialize(default_name, patient) ⇒ AugmentedModalityName

Returns a new instance of AugmentedModalityName.



24
25
26
27
# File 'app/models/renalware/hd/modality_description.rb', line 24

def initialize(default_name, patient)
  @patient = HD.cast_patient(patient)
  @default_name = default_name
end

Instance Method Details

#to_sObject



29
30
31
32
33
# File 'app/models/renalware/hd/modality_description.rb', line 29

def to_s
  return default_name if patient.blank? || unit_code.blank?

  "#{default_name} (#{unit_code})"
end