Class: Belajar::Views::TaskView

Inherits:
Object
  • Object
show all
Includes:
Belajar::Views, Wisper::Publisher
Defined in:
lib/belajar/views/task_view.rb

Constant Summary collapse

TOP_BAR_TEXT =
[
  'Scroll with * 🠕 * and * 🠗 *',
  'Open solution file with *o*',
  'Verify solution with *v*',
  'Clear validation with *c*',
  'Exit with *Esc*'
].join('  |  ').freeze

Instance Method Summary collapse

Methods included from Belajar::Views

#reset_menu_position

Constructor Details

#initializeTaskView

Returns a new instance of TaskView.



18
19
20
21
# File 'lib/belajar/views/task_view.rb', line 18

def initialize
  @lines = []
  @top   = nil
end

Instance Method Details

#enter(course, chapter, unit) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/belajar/views/task_view.rb', line 23

def enter(course, chapter, unit)
  @course  = course
  @chapter = chapter
  @unit    = unit

  @test_result_lines = nil
  @lines             = @unit.task.markdown.lines
  @top_bar_height    = 4
  @head_height       = 2

  initialize_window(@lines.count + @top_bar_height + @head_height)
end