Sha256: 9403b13611bd0c22b878e109b3c942c4cf78b999b4880cef48414412b31a5965

Contents?: true

Size: 509 Bytes

Versions: 3

Compression:

Stored size: 509 Bytes

Contents

module TP
  class Slide
    attr_accessor :markdown

    def initialize(markdown)
      self.markdown = markdown.strip
    end

    def header
      match = markdown.match /^#\s*(.+)(?:\n)*/

      match[1] if match
    end

    def body
      match = markdown.match /^#\s*.+\n\n(.*)/m

      match[1] if match
    end

    def bullets
      return unless body

      result = body.scan(/^\*\s+(.+)/).flatten

      result if result.any?
    end

    def paragraph
      body unless bullets
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tp-0.1.1 lib/tp/slide.rb
tp-0.1.0 lib/tp/slide.rb
tp-0.0.2 lib/tp/slide.rb