Sha256: 4ff9c62f39ed157ed55be19356da2881b7a8d9dcb906f71919006be23371091c

Contents?: true

Size: 728 Bytes

Versions: 3

Compression:

Stored size: 728 Bytes

Contents

# frozen_string_literal: true

require "refinements/pathname"

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

3 entries across 3 versions & 1 rubygems

Version Path
milestoner-17.11.0 lib/milestoner/builders/markdown.rb
milestoner-17.10.0 lib/milestoner/builders/markdown.rb
milestoner-17.9.0 lib/milestoner/builders/markdown.rb