Class: Dsu::Presenters::EntryGroup::List::DatePresenter

Inherits:
BasePresenterEx show all
Includes:
Messages, NothingToList
Defined in:
lib/dsu/presenters/entry_group/list/date_presenter.rb

Instance Method Summary collapse

Methods included from NothingToList

#nothing_to_list?

Constructor Details

#initialize(times:, options: {}) ⇒ DatePresenter

Returns a new instance of DatePresenter.

Raises:

  • (ArgumentError)


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 options.is_a?(Hash)

  super(options: options)

  @times = times
end

Instance Method Details

#display_nothing_to_list_messageObject



36
37
38
39
40
# File 'lib/dsu/presenters/entry_group/list/date_presenter.rb', line 36

def display_nothing_to_list_message
  # 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

#renderObject



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