2018-08-03 13:22:24 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-03-07 01:42:30 -05:00
|
|
|
module Network
|
2013-02-25 23:28:11 -05:00
|
|
|
class Commit
|
|
|
|
include ActionView::Helpers::TagHelper
|
|
|
|
|
2013-03-07 03:56:01 -05:00
|
|
|
attr_accessor :time, :spaces, :parent_spaces
|
2013-02-25 23:28:11 -05:00
|
|
|
|
2013-08-19 23:05:23 -04:00
|
|
|
def initialize(raw_commit)
|
|
|
|
@commit = raw_commit
|
2013-02-25 23:28:11 -05:00
|
|
|
@time = -1
|
2013-02-27 08:37:38 -05:00
|
|
|
@spaces = []
|
2013-02-25 23:28:11 -05:00
|
|
|
@parent_spaces = []
|
|
|
|
end
|
|
|
|
|
2018-07-04 10:02:01 -04:00
|
|
|
def method_missing(msg, *args, &block)
|
|
|
|
@commit.__send__(msg, *args, &block) # rubocop:disable GitlabSecurity/PublicSend
|
2013-02-25 23:28:11 -05:00
|
|
|
end
|
2013-02-27 08:37:38 -05:00
|
|
|
|
|
|
|
def space
|
2018-09-18 03:36:24 -04:00
|
|
|
if @spaces.present?
|
2013-02-27 08:37:38 -05:00
|
|
|
@spaces.first
|
|
|
|
else
|
|
|
|
0
|
|
|
|
end
|
|
|
|
end
|
2013-03-07 06:36:40 -05:00
|
|
|
|
|
|
|
def parents(map)
|
2018-03-06 08:32:48 -05:00
|
|
|
map.values_at(*@commit.parent_ids).compact
|
2013-03-07 06:36:40 -05:00
|
|
|
end
|
2013-02-25 23:28:11 -05:00
|
|
|
end
|
|
|
|
end
|