summaryrefslogtreecommitdiff
path: root/lib/booru/commit_info.rb
blob: 5f6f43030ddafac1b2a601bf28cff2e83c417a41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# frozen_string_literal: true

module Booru
  # Helper class for CommitHistory.
  class CommitInfo
    # The specific git object ID associated with this commit
    # as a string (e.g. "3717f613f48df0222311f974cf8a06c8a6c97bae").
    #
    # @return [String]
    attr_reader :id

    # The time this commit was made.
    #
    # @return [Time]
    attr_reader :time

    # The name of the author of this commit
    # as a string (e.g. "Linus Torvalds").
    #
    # @return [String]
    attr_reader :name

    # The email address of the author of this commit
    # as a string (e.g. "[email protected]").
    #
    # @return [String]
    attr_reader :email

    # The full commit message for this commit, including
    # any trailing newlines.
    #
    # @return [String]
    attr_reader :message

    # The number of insertions in a line-based diff for this commit.
    # The diff base is the tree of the first parent commit.
    #
    # @return [Integer]
    attr_reader :insertions

    # The number of deletions in a line-based diff for this commit.
    # The diff base is the tree of the first parent commit.
    #
    # @return [Integer]
    attr_reader :deletions

    # Create a new CommitInfo object with the specified parameters.
    def initialize(id:, time:, name:, email:, message:, insertions:, deletions:)
      @id         = id
      @time       = time
      @name       = name
      @email      = email
      @message    = message
      @insertions = insertions
      @deletions  = deletions
    end
  end
end