Class: ThinkFeelDoEngine::LessonEvent::CompletionDataPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/think_feel_do_engine/lesson_event/completion_data_presenter.rb

Overview

Creates a presenter for the logic of the completion data partial

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event:, lesson_module:) ⇒ CompletionDataPresenter

Returns a new instance of CompletionDataPresenter.



8
9
10
11
# File 'app/presenters/think_feel_do_engine/lesson_event/completion_data_presenter.rb', line 8

def initialize(event:, lesson_module:)
  @event = event
  @lesson_module = lesson_module
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



6
7
8
# File 'app/presenters/think_feel_do_engine/lesson_event/completion_data_presenter.rb', line 6

def event
  @event
end

#lesson_moduleObject (readonly)

Returns the value of attribute lesson_module.



6
7
8
# File 'app/presenters/think_feel_do_engine/lesson_event/completion_data_presenter.rb', line 6

def lesson_module
  @lesson_module
end

Instance Method Details

#last_page_number_openedObject



13
14
15
# File 'app/presenters/think_feel_do_engine/lesson_event/completion_data_presenter.rb', line 13

def last_page_number_opened
  event[:last_page_number_opened]
end

#last_page_opened_atObject



17
18
19
# File 'app/presenters/think_feel_do_engine/lesson_event/completion_data_presenter.rb', line 17

def last_page_opened_at
  DateTime.iso8601(event[:last_page_opened_at])
end

#page_headersObject



21
22
23
24
25
# File 'app/presenters/think_feel_do_engine/lesson_event/completion_data_presenter.rb', line 21

def page_headers
  event[:page_headers].try do |page_headers|
    page_headers[2]
  end
end

#pretty_titleObject



27
28
29
# File 'app/presenters/think_feel_do_engine/lesson_event/completion_data_presenter.rb', line 27

def pretty_title
  lesson.pretty_title
end

#selected_atObject



31
32
33
# File 'app/presenters/think_feel_do_engine/lesson_event/completion_data_presenter.rb', line 31

def selected_at
  DateTime.iso8601(event[:lesson_selected_at])
end