Sha256: e02ab135f559b875b65655622f3efbb929b61f7f05616a7c259ef37a5b31a092
Contents?: true
Size: 771 Bytes
Versions: 1
Compression:
Stored size: 771 Bytes
Contents
module TP class Slide attr_accessor :markdown def initialize(markdown) self.markdown = markdown.strip end def header line = lines.first line[1, line.length - 1].to_s.strip end def body result = lines[2, lines.count - 2] result.join "" if result end def bullets return unless body result = body.scan(/^\*\s+(.+)/).flatten result if result.any? end def paragraph body unless bullets end def width return header.length unless body (body.lines.to_a.collect(&:length) + [header.length]).max end def height return 1 unless body body.lines.count + 2 end private def lines markdown.lines.to_a end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tp-0.3.1 | lib/tp/slide.rb |