Class: Teletype::Practice

Inherits:
Object
  • Object
show all
Defined in:
lib/teletype/practice.rb

Overview

Initializes screen size and click stats, then start the practice page by page.

Instance Method Summary collapse

Constructor Details

#initialize(profile, text:, height:, width:, suggest:, verbose:) ⇒ Practice

Returns a new instance of Practice.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/teletype/practice.rb', line 6

def initialize(profile, text:, height:, width:, suggest:, verbose:)
  @stats = Stats.new(profile, text)
  @paginator = Paginator.new(
    profile, text,
    height: height,
    width: width,
    suggest: suggest,
    verbose: verbose,
    stats: @stats
  )
end

Instance Method Details

#startObject



18
19
20
21
22
23
24
25
# File 'lib/teletype/practice.rb', line 18

def start
  at_exit do
    @stats.save
    @paginator.save
  end

  @paginator.run
end