Sha256: 31f49088eeb06bb936463b76cdd46baa5064971dd14104c3b2ee8b33e1c27e81

Contents?: true

Size: 790 Bytes

Versions: 5

Compression:

Stored size: 790 Bytes

Contents

# frozen_string_literal: true

require "gitt"

module Milestoner
  module Models
    COMMIT_COMMON_ATTRIBUTES = %i[
      authored_at
      body
      deletions
      files_changed
      fingerprint
      fingerprint_key
      insertions
      notes
      sha
      signature
      subject
    ].freeze

    COMMIT_ENRICHED_ATTRIBUTES = %i[
      author
      collaborators
      format
      issue
      milestone
      review
      signers
      uri
    ].freeze

    # Represents an enriched commit.
    Commit = Struct.new(*COMMIT_COMMON_ATTRIBUTES, *COMMIT_ENRICHED_ATTRIBUTES) do
      include Gitt::Directable

      def self.for(commit, **) = new(**commit.to_h.slice(*COMMIT_COMMON_ATTRIBUTES), **)

      def initialize(**)
        super
        freeze
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
milestoner-18.3.0 lib/milestoner/models/commit.rb
milestoner-18.2.0 lib/milestoner/models/commit.rb
milestoner-18.1.0 lib/milestoner/models/commit.rb
milestoner-18.0.1 lib/milestoner/models/commit.rb
milestoner-18.0.0 lib/milestoner/models/commit.rb