When multiple conditions (OR) in case statement lead to the same code.

Tedious and inefficient way….

case telecom_type_code
  when 1
    telecom.phone_number = telecom_value
    telecom.url_scheme = tel_url_scheme
  when 2
    telecom.phone_number = telecom_value
    telecom.url_scheme = tel_url_scheme

  when 3
    telecom.phone_number = telecom_value
    telecom.url_scheme = tel_url_scheme

  when 4
    telecom.phone_number = telecom_value
    telecom.url_scheme = tel_url_scheme

  when 5
    telecom.email = telecom_value
    telecom.url_scheme = email_url_scheme
  else
    raise "Error, unknown telecommunication type of #{telecom_type_code}"
end

A much better way and not to mention more efficient way to write the same thing…

case telecom_type_code
  when 1, 2, 3, 4
    telecom.phone_number = telecom_value
    telecom.url_scheme = tel_url_scheme
  when 5
    telecom.email = telecom_value
    telecom.url_scheme = email_url_scheme
  else
    raise "Error, unknown telecommunication type of #{telecom_type_code}"
end

Both have the same meaning and reads, “when the telecom_type_code is either 1, 2, 3, or 4, assign the telecom_value to phone_number, and tel_url_scheme to url_sheme. ¬†When the type is 5 it is going to be an email assignment.