summaryrefslogtreecommitdiff
path: root/app/models/network/commit.rb
blob: 22d48c9e6613e999a2a13c9ff0a75f019450fefc (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
module Network
  class Commit
    include ActionView::Helpers::TagHelper

    attr_accessor :time, :spaces, :parent_spaces

    def initialize(raw_commit)
      @commit = raw_commit
      @time = -1
      @spaces = []
      @parent_spaces = []
    end

    def method_missing(m, *args, &block)
      @commit.__send__(m, *args, &block) # rubocop:disable GitlabSecurity/PublicSend
    end

    def space
      if @spaces.size > 0
        @spaces.first
      else
        0
      end
    end

    def parents(map)
      map.values_at(*@commit.parent_ids).compact
    end
  end
end