Class: ThinkFeelDoEngine::LessonEvent::CompletionDataPresenter
- Inherits:
-
Object
- Object
- ThinkFeelDoEngine::LessonEvent::CompletionDataPresenter
- 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
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#lesson_module ⇒ Object
readonly
Returns the value of attribute lesson_module.
Instance Method Summary collapse
-
#initialize(event:, lesson_module:) ⇒ CompletionDataPresenter
constructor
A new instance of CompletionDataPresenter.
- #last_page_number_opened ⇒ Object
- #last_page_opened_at ⇒ Object
- #page_headers ⇒ Object
- #pretty_title ⇒ Object
- #selected_at ⇒ Object
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
#event ⇒ Object (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_module ⇒ Object (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_opened ⇒ Object
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_at ⇒ Object
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_headers ⇒ Object
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_title ⇒ Object
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_at ⇒ Object
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 |