Class: TtySlides

Inherits:
Object
  • Object
show all
Defined in:
lib/tty_slides.rb,
lib/tty_slides/version.rb

Defined Under Namespace

Modules: Options Classes: MainWindow, QandAClient, QandAWindow, SlideList

Constant Summary collapse

VERSION =
"0.0.3"

Instance Method Summary collapse

Constructor Details

#initialize(title = '') ⇒ TtySlides

Returns a new instance of TtySlides.



18
19
20
21
22
23
24
25
26
27
# File 'lib/tty_slides.rb', line 18

def initialize title=''
  @title   = title
  @options = Options.parse!
  @height  = Curses.lines
  @width   = Curses.cols
  @slides  = SlideList.new(@options.start_at)
  setup_windows
  exit_handlers
  setup_q_and_a
end

Instance Method Details

#startObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/tty_slides.rb', line 29

def start
  CML.new(@main_window, File.read(@slides.next)).render

  loop do
    case STDIN.getch
    when /b/i
      CML.new(@main_window, File.read(@slides.previous)).render
    when /q/i
      exit
    else
      CML.new(@main_window, File.read(@slides.next)).render
    end
  end
end