Sha256: 6b11d9825ad13c4c944b9b4c20844bb826eac2c9f69b85f9873d2e772129fc1c

Contents?: true

Size: 583 Bytes

Versions: 4

Compression:

Stored size: 583 Bytes

Contents

class TP::Slide::Bulleted < TP::Slide
  BULLET = "\u2022 "

  def render
    frames.last
  end

  def width
    header_length = header.length
    longest_bullet = bullets.collect(&:length).max + 2
    [header_length, longest_bullet].max
  end

  def bullets
    content.lines.to_a.map { |line| line.gsub(/^\*\s/, "").strip }
  end

  def frames
    return @frames if @frames

    buffer = centered_header
    buffer << "\n\n"

    @frames = [buffer.dup]

    bullets.each do |bullet|
      buffer << "#{BULLET} #{bullet}\n"
      @frames << buffer.dup
    end

    @frames
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tp-0.5.1 lib/tp/slide/bulleted.rb
tp-0.5.0 lib/tp/slide/bulleted.rb
tp-0.4.1 lib/tp/slide/bulleted.rb
tp-0.4.0 lib/tp/slide/bulleted.rb