Sha256: 9de71c041705222d9272b3f42f21015927a1e0e25040156eacbfa6b1c484f587

Contents?: true

Size: 742 Bytes

Versions: 13

Compression:

Stored size: 742 Bytes

Contents

# frozen_string_literal: true

require "forwardable"
require "git_plus"

module Milestoner
  module Presenters
    # Wraps the Git Kit Commit for presentation purposes.
    class Commit
      extend Forwardable

      delegate [*GitPlus::Commit.members, :fixup?, :squash?] => :record

      def initialize record, container: Container
        @record = record
        @container = container
      end

      def line_item(delimiter: " - ") = "#{bullet}#{subject}#{delimiter}#{author_name}"

      private

      attr_reader :record, :container

      def bullet
        case container[:configuration].documentation_format
          when "md" then "- "
          when "adoc" then "* "
          else ""
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
milestoner-13.3.1 lib/milestoner/presenters/commit.rb
milestoner-13.3.0 lib/milestoner/presenters/commit.rb
milestoner-13.2.0 lib/milestoner/presenters/commit.rb
milestoner-13.1.0 lib/milestoner/presenters/commit.rb
milestoner-13.0.1 lib/milestoner/presenters/commit.rb
milestoner-13.0.0 lib/milestoner/presenters/commit.rb
milestoner-12.2.0 lib/milestoner/presenters/commit.rb
milestoner-12.1.0 lib/milestoner/presenters/commit.rb
milestoner-12.0.4 lib/milestoner/presenters/commit.rb
milestoner-12.0.3 lib/milestoner/presenters/commit.rb
milestoner-12.0.2 lib/milestoner/presenters/commit.rb
milestoner-12.0.1 lib/milestoner/presenters/commit.rb
milestoner-12.0.0 lib/milestoner/presenters/commit.rb