Sha256: 0ca12dfa78f09feea6aea25795d1d06cf008e01da1c68c74f1e64ca66fdd371d

Contents?: true

Size: 468 Bytes

Versions: 5

Compression:

Stored size: 468 Bytes

Contents

# frozen_string_literal: true

module Tocer
  module Parsers
    # Represents a Markdown header.
    class Header
      def self.punctuation
        "#"
      end

      def initialize markdown
        @markdown = markdown
      end

      def prefix
        String markdown[/#{self.class.punctuation}{1,}/]
      end

      def content
        markdown[prefix.length + 1, markdown.length].strip
      end

      private

      attr_reader :markdown
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tocer-3.1.1 lib/tocer/parsers/header.rb
tocer-3.1.0 lib/tocer/parsers/header.rb
tocer-3.0.0 lib/tocer/parsers/header.rb
tocer-2.2.0 lib/tocer/parsers/header.rb
tocer-2.1.0 lib/tocer/parsers/header.rb