Class: Spina::Pages::MenuPresenter
- Inherits:
-
Object
- Object
- Spina::Pages::MenuPresenter
- Includes:
- ActionView::Helpers::TagHelper, ActionView::Helpers::UrlHelper, ActiveSupport::Configurable
- Defined in:
- app/presenters/spina/pages/menu_presenter.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
Returns the value of attribute collection.
-
#context ⇒ Object
Returns the value of attribute context.
-
#current_menu_item ⇒ Object
Returns the value of attribute current_menu_item.
Instance Method Summary collapse
-
#initialize(collection, context, current_menu_item = nil) ⇒ MenuPresenter
constructor
A new instance of MenuPresenter.
- #to_html ⇒ Object
Constructor Details
#initialize(collection, context, current_menu_item = nil) ⇒ MenuPresenter
Returns a new instance of MenuPresenter.
28 29 30 31 32 33 |
# File 'app/presenters/spina/pages/menu_presenter.rb', line 28 def initialize(collection, context, =nil) @collection = collection @context = context @current_menu_item = @selected_menu_items = [@current_menu_item] + @current_menu_item.try(:ancestors) end |
Instance Attribute Details
#collection ⇒ Object
Returns the value of attribute collection.
25 26 27 |
# File 'app/presenters/spina/pages/menu_presenter.rb', line 25 def collection @collection end |
#context ⇒ Object
Returns the value of attribute context.
25 26 27 |
# File 'app/presenters/spina/pages/menu_presenter.rb', line 25 def context @context end |
#current_menu_item ⇒ Object
Returns the value of attribute current_menu_item.
25 26 27 |
# File 'app/presenters/spina/pages/menu_presenter.rb', line 25 def @current_menu_item end |
Instance Method Details
#to_html ⇒ Object
35 36 37 |
# File 'app/presenters/spina/pages/menu_presenter.rb', line 35 def to_html render_list_wrapper(collection) if collection.present? end |