Class: HasHelpers::ItemPresenter
- Inherits:
-
BasePresenter
- Object
- BasePresenter
- HasHelpers::ItemPresenter
- Defined in:
- app/presenters/has_helpers/item_presenter.rb
Overview
typed: true frozen_string_literal: true
Instance Attribute Summary collapse
-
#data ⇒ Object
writeonly
Sets the attribute data.
- #details ⇒ Object
-
#emphasized ⇒ Object
Returns the value of attribute emphasized.
-
#highlight ⇒ Object
Returns the value of attribute highlight.
- #icon ⇒ Object
- #image_service ⇒ Object
-
#is_heading ⇒ Object
Returns the value of attribute is_heading.
- #items ⇒ Object
-
#name ⇒ Object
Returns the value of attribute name.
-
#selected ⇒ Object
Returns the value of attribute selected.
- #service ⇒ Object
-
#status ⇒ Object
Returns the value of attribute status.
-
#tag ⇒ Object
Returns the value of attribute tag.
- #title ⇒ Object
Attributes inherited from BasePresenter
Instance Method Summary collapse
Methods inherited from BasePresenter
#==, #error_on, #initialize, wrap, wrap_with_options
Methods included from Attributes
Constructor Details
This class inherits a constructor from HasHelpers::BasePresenter
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class HasHelpers::BasePresenter
Instance Attribute Details
#data=(value) ⇒ Object (writeonly)
Sets the attribute data
6 7 8 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 6 def data=(value) @data = value end |
#details ⇒ Object
10 11 12 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 10 def details Array[*@details] end |
#emphasized ⇒ Object
Returns the value of attribute emphasized.
5 6 7 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 5 def emphasized @emphasized end |
#highlight ⇒ Object
Returns the value of attribute highlight.
5 6 7 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 5 def highlight @highlight end |
#icon ⇒ Object
30 31 32 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 30 def icon @icon && @icon.to_icon end |
#image_service ⇒ Object
18 19 20 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 18 def image_service @image_service && @image_service.to_service end |
#is_heading ⇒ Object
Returns the value of attribute is_heading.
5 6 7 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 5 def is_heading @is_heading end |
#items ⇒ Object
34 35 36 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 34 def items ::HasHelpers::ItemPresenter.new(items: @items) if @items end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 5 def name @name end |
#selected ⇒ Object
Returns the value of attribute selected.
5 6 7 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 5 def selected @selected end |
#service ⇒ Object
14 15 16 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 14 def service @service && @service.to_service end |
#status ⇒ Object
Returns the value of attribute status.
5 6 7 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 5 def status @status end |
#tag ⇒ Object
Returns the value of attribute tag.
5 6 7 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 5 def tag @tag end |
#title ⇒ Object
38 39 40 41 42 43 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 38 def title case @title when TrueClass then name else @title end end |
Instance Method Details
#attributes ⇒ Object
45 46 47 48 49 50 51 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 45 def attributes (@data || {}).tap do |data_hash| data_hash.keys.each do |k| data_hash["data-#{k}"] = data_hash.delete(k) end end end |
#cache_key ⇒ Object
22 23 24 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 22 def cache_key nil end |
#item ⇒ Object
26 27 28 |
# File 'app/presenters/has_helpers/item_presenter.rb', line 26 def item self end |