Sha256: 0e2aa43122cad706f141d0c4b4780676eb7a94f5d124370c64b2da84c03bbe37

Contents?: true

Size: 945 Bytes

Versions: 1

Compression:

Stored size: 945 Bytes

Contents

# frozen_string_literal: true

require "gitt"

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

    COMMIT_ENRICHED_ATTRIBUTES = %i[
      author
      collaborators
      created_at
      format
      issue
      milestone
      position
      review
      signers
      updated_at
      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

1 entries across 1 versions & 1 rubygems

Version Path
milestoner-18.12.0 lib/milestoner/models/commit.rb