Class: Renalware::MDMHelper::MDMLink

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers
Defined in:
app/helpers/renalware/mdm_helper.rb

Overview

Create an html link to the MDM appropriate to the patient’s current modality

Instance Method Summary collapse

Constructor Details

#initialize(patient) ⇒ MDMLink

Returns a new instance of MDMLink.



16
17
18
# File 'app/helpers/renalware/mdm_helper.rb', line 16

def initialize(patient)
  @patient = patient
end

Instance Method Details

#pathObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/helpers/renalware/mdm_helper.rb', line 20

def path
  @path ||= begin
    return if modality_description.type.blank?

    case modality_description_symbol
    when :pd then patient_pd_mdm_path(patient)
    when :hd then patient_hd_mdm_path(patient)
    when :transplant then patient_transplants_mdm_path(patient)
    when :low_clearance then patient_low_clearance_mdm_path(patient)
    end
  end
end

#to_htmlObject



33
34
35
# File 'app/helpers/renalware/mdm_helper.rb', line 33

def to_html
  link_to(mdm_name, path) if path
end