Sha256: 79d914336e4b55afd1805058f4e63027467d72d9230ca3e16d872b36e32d2edf
Contents?: true
Size: 863 Bytes
Versions: 1
Compression:
Stored size: 863 Bytes
Contents
module TP class Presenter attr_accessor :markdown def initialize(markdown) self.markdown = markdown end def present Screen.suggest 30, 8 Keyboard.wait_for_return loop do Renderer.new(slide_deck.current_slide).render case Keyboard.read when :right, :down, :space, :return, 'l', 'k', 'd', 's' slide_deck.next when :left, :up, :backspace, 'h', 'j', 'a', 'w' slide_deck.previous when 'q' break end break if slide_deck.ended? end Screen.clear! end def slides result = markdown.split /^# / result.reject! &:empty? result.map! { |string| string.prepend "#" } result.map { |string| Slide.new string } end def slide_deck @slide_deck ||= SlideDeck.new slides end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tp-0.2.0 | lib/tp/presenter.rb |