2013-03-07 06:42:30 +00:00
|
|
|
module Network
|
2013-02-26 04:28:11 +00:00
|
|
|
class Commit
|
|
|
|
include ActionView::Helpers::TagHelper
|
|
|
|
|
2013-03-07 08:56:01 +00:00
|
|
|
attr_accessor :time, :spaces, :parent_spaces
|
2013-02-26 04:28:11 +00:00
|
|
|
|
2013-08-20 03:05:23 +00:00
|
|
|
def initialize(raw_commit)
|
|
|
|
@commit = raw_commit
|
2013-02-26 04:28:11 +00:00
|
|
|
@time = -1
|
2013-02-27 13:37:38 +00:00
|
|
|
@spaces = []
|
2013-02-26 04:28:11 +00:00
|
|
|
@parent_spaces = []
|
|
|
|
end
|
|
|
|
|
|
|
|
def method_missing(m, *args, &block)
|
2013-03-07 08:56:01 +00:00
|
|
|
@commit.send(m, *args, &block)
|
2013-02-26 04:28:11 +00:00
|
|
|
end
|
2013-02-27 13:37:38 +00:00
|
|
|
|
|
|
|
def space
|
|
|
|
if @spaces.size > 0
|
|
|
|
@spaces.first
|
|
|
|
else
|
|
|
|
0
|
|
|
|
end
|
|
|
|
end
|
2013-03-07 11:36:40 +00:00
|
|
|
|
|
|
|
def parents(map)
|
|
|
|
@commit.parents.map do |p|
|
|
|
|
if map.include?(p.id)
|
|
|
|
map[p.id]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
.compact
|
|
|
|
end
|
2013-02-26 04:28:11 +00:00
|
|
|
end
|
|
|
|
end
|