Sha256: c655551c5f01f5d0d24dde23149de06e8933f14962f849425ef790f922d0ae28

Contents?: true

Size: 432 Bytes

Versions: 29

Compression:

Stored size: 432 Bytes

Contents

# frozen_string_literal: true

module Tocer
  module Parsers
    # Represents a Markdown header.
    class Header
      PUNCTUATION = "#"

      def initialize markdown
        @markdown = markdown
      end

      def prefix
        String markdown[/#{PUNCTUATION}{1,}/]
      end

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

      private

      attr_reader :markdown
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
tocer-10.4.0 lib/tocer/parsers/header.rb
tocer-10.3.0 lib/tocer/parsers/header.rb
tocer-10.2.0 lib/tocer/parsers/header.rb
tocer-10.1.1 lib/tocer/parsers/header.rb
tocer-10.1.0 lib/tocer/parsers/header.rb
tocer-10.0.1 lib/tocer/parsers/header.rb
tocer-10.0.0 lib/tocer/parsers/header.rb
tocer-9.1.2 lib/tocer/parsers/header.rb
tocer-9.1.1 lib/tocer/parsers/header.rb
tocer-9.1.0 lib/tocer/parsers/header.rb
tocer-9.0.0 lib/tocer/parsers/header.rb
tocer-8.2.1 lib/tocer/parsers/header.rb
tocer-8.2.0 lib/tocer/parsers/header.rb
tocer-8.1.0 lib/tocer/parsers/header.rb
tocer-8.0.0 lib/tocer/parsers/header.rb
tocer-7.2.0 lib/tocer/parsers/header.rb
tocer-7.1.0 lib/tocer/parsers/header.rb
tocer-7.0.2 lib/tocer/parsers/header.rb
tocer-7.0.1 lib/tocer/parsers/header.rb
tocer-7.0.0 lib/tocer/parsers/header.rb