Class: Renalware::DefinitionListHelper::DefinitionList
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Renalware::DefinitionListHelper::DefinitionList
- Includes:
- ActionView::Context, ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper
- Defined in:
- app/helpers/renalware/definition_list_helper.rb
Instance Method Summary collapse
- #definition(attribute) ⇒ Object
-
#initialize(model) ⇒ DefinitionList
constructor
A new instance of DefinitionList.
Constructor Details
#initialize(model) ⇒ DefinitionList
Returns a new instance of DefinitionList.
10 11 12 13 |
# File 'app/helpers/renalware/definition_list_helper.rb', line 10 def initialize(model) @model_klass = model.class super(model) end |
Instance Method Details
#definition(attribute) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/renalware/definition_list_helper.rb', line 15 def definition(attribute) text = @model_klass.human_attribute_name(attribute) value = public_send(attribute) value = yield(value) if value.present? && block_given? capture do concat content_tag(:dt, text) concat content_tag(:dd, value) end end |