Sha256: d0448ab3949d20238d34981a45cc8e0416998d8db521861ccb35a6a5ab747a4d

Contents?: true

Size: 696 Bytes

Versions: 1

Compression:

Stored size: 696 Bytes

Contents

# frozen_string_literal: true

module Milestoner
  module Builders
    # Builds Markdown page output.
    class Markdown
      include Milestoner::Import[:input]

      using Refinements::Pathname

      def initialize(view: Views::Milestones::Show.new, enricher: Commits::Enricher.new, **)
        @view = view
        @enricher = enricher
        super(**)
      end

      def call = input.build_root.join("index.md").make_ancestors.tap { |path| write path }

      private

      attr_reader :view, :enricher

      def write path
        enricher.call.fmap do |commits|
          path.write view.call commits:, layout: input.build_layout, format: :md
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
milestoner-17.6.0 lib/milestoner/builders/markdown.rb