Class: Renalware::HD::UnmetPreferencesPresenter
- Inherits:
-
Object
- Object
- Renalware::HD::UnmetPreferencesPresenter
- Includes:
- ActionView::Helpers
- Defined in:
- app/presenters/renalware/hd/unmet_preferences_presenter.rb
Constant Summary collapse
- COMMON_ATTRIBUTES =
%i(schedule_definition other_schedule hospital_unit).freeze
Instance Method Summary collapse
-
#initialize(patient) ⇒ UnmetPreferencesPresenter
constructor
A new instance of UnmetPreferencesPresenter.
- #preference_satisfied?(attribute) ⇒ Boolean
-
#preferred(attribute) ⇒ Object
Returns the HD::PreferenceSet setting if it differs from that in the HD::Profile If the preference is unmet, wrap in a <b> tag.
Constructor Details
#initialize(patient) ⇒ UnmetPreferencesPresenter
Returns a new instance of UnmetPreferencesPresenter.
19 20 21 |
# File 'app/presenters/renalware/hd/unmet_preferences_presenter.rb', line 19 def initialize(patient) @patient = patient end |
Instance Method Details
#preference_satisfied?(attribute) ⇒ Boolean
34 35 36 37 38 39 40 |
# File 'app/presenters/renalware/hd/unmet_preferences_presenter.rb', line 34 def preference_satisfied?(attribute) preferred = public_send(:"preferred_#{attribute}") current = public_send(:"current_#{attribute}") return true if preferred.blank? || preferred == current false end |
#preferred(attribute) ⇒ Object
Returns the HD::PreferenceSet setting if it differs from that in the HD::Profile If the preference is unmet, wrap in a <b> tag. Yield the value so the template has a chance to format it before it is wrapped.
26 27 28 29 30 31 32 |
# File 'app/presenters/renalware/hd/unmet_preferences_presenter.rb', line 26 def preferred(attribute) value = public_send(:"preferred_#{attribute}") value = yield(value) if block_given? return value if preference_satisfied?(attribute) content_tag(:b, value) end |