class Patterns::Pediatrician

Pediatrician -> Doctor

Public Instance Methods

description() click to toggle source

Description of the pediatrician

# File app/models/chain_of_responsibility/pediatrician.rb, line 15
def description
  'Can handle non life threatening illnesses in children under the age of 18.'
end
see_patient(patient) click to toggle source

The pediatrician sees a patient, cures the patient if they are a child and have a sore throat, passes up the chain otherwise

Calls superclass method Patterns::Doctor#see_patient
# File app/models/chain_of_responsibility/pediatrician.rb, line 5
def see_patient(patient)
  super(patient)
  if patient.age < 18 && patient.has_illness? && patient.illness == SORE_THROAT
    patient.set_illness(NONE)
  else
    send_up_chain(patient)
  end
end