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.



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

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

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



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

def event
  @event
end

#lesson_moduleObject (readonly)

Returns the value of attribute lesson_module.



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

def lesson_module
  @lesson_module
end

Instance Method Details

#last_page_number_openedObject



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

def last_page_number_opened
  event[:last_page_number_opened]
end

#last_page_opened_atObject



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

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

#page_headersObject



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

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

#pretty_titleObject



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

def pretty_title
  lesson.pretty_title
end

#selected_atObject



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

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