2018-11-20 20:47:30 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-02 18:07:02 +05: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
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
def method_missing(msg, *args, &block)
|
|
|
|
@commit.__send__(msg, *args, &block) # rubocop:disable GitlabSecurity/PublicSend
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def space
|
2018-12-05 23:21:45 +05:30
|
|
|
if @spaces.present?
|
2014-09-02 18:07:02 +05:30
|
|
|
@spaces.first
|
|
|
|
else
|
|
|
|
0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def parents(map)
|
2018-03-27 19:54:05 +05:30
|
|
|
map.values_at(*@commit.parent_ids).compact
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|