Class: Dsu::Presenters::EntryGroup::List::DatePresenter
- Inherits:
-
BasePresenterEx
- Object
- BasePresenterEx
- Dsu::Presenters::EntryGroup::List::DatePresenter
- Includes:
- Messages, NothingToList
- Defined in:
- lib/dsu/presenters/entry_group/list/date_presenter.rb
Instance Method Summary collapse
- #display_nothing_to_list_message ⇒ Object
-
#initialize(times:, options: {}) ⇒ DatePresenter
constructor
A new instance of DatePresenter.
- #render ⇒ Object
Methods included from NothingToList
Constructor Details
#initialize(times:, options: {}) ⇒ DatePresenter
Returns a new instance of DatePresenter.
18 19 20 21 22 23 24 25 |
# File 'lib/dsu/presenters/entry_group/list/date_presenter.rb', line 18 def initialize(times:, options: {}) raise ArgumentError, 'times must be an Array' unless times.is_a?(Array) raise ArgumentError, 'options must be a Hash' unless .is_a?(Hash) super(options: ) @times = times end |
Instance Method Details
#display_nothing_to_list_message ⇒ Object
36 37 38 39 40 |
# File 'lib/dsu/presenters/entry_group/list/date_presenter.rb', line 36 def # This presenter will ALWAYS have something to list (display) since the first # and last (if different) entry groups will always be displayed. raise 'display_nothing_to_list_message called when there are entries to display' end |
#render ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/dsu/presenters/entry_group/list/date_presenter.rb', line 27 def render return if nothing_to_list? entry_groups.each do |entry_group| Views::EntryGroup::Show.new(entry_group: entry_group).render puts end end |