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.
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
#event ⇒ Object (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_module ⇒ Object (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_opened ⇒ Object
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_at ⇒ Object
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_headers ⇒ Object
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_title ⇒ Object
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_at ⇒ Object
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 |