Refactor: rename module and class names.
* Module: Graph -> Network * Class: JsonBuilder -> Graph
This commit is contained in:
parent
784aa266bd
commit
e03a018d28
5 changed files with 13 additions and 13 deletions
39
app/models/network/commit.rb
Normal file
39
app/models/network/commit.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
require "grit"
|
||||
|
||||
module Network
|
||||
class Commit
|
||||
include ActionView::Helpers::TagHelper
|
||||
|
||||
attr_accessor :time, :spaces, :refs, :parent_spaces
|
||||
|
||||
def initialize(commit)
|
||||
@_commit = commit
|
||||
@time = -1
|
||||
@spaces = []
|
||||
@parent_spaces = []
|
||||
end
|
||||
|
||||
def method_missing(m, *args, &block)
|
||||
@_commit.send(m, *args, &block)
|
||||
end
|
||||
|
||||
def add_refs(ref_cache, repo)
|
||||
if ref_cache.empty?
|
||||
repo.refs.each do |ref|
|
||||
ref_cache[ref.commit.id] ||= []
|
||||
ref_cache[ref.commit.id] << ref
|
||||
end
|
||||
end
|
||||
@refs = ref_cache[@_commit.id] if ref_cache.include?(@_commit.id)
|
||||
@refs ||= []
|
||||
end
|
||||
|
||||
def space
|
||||
if @spaces.size > 0
|
||||
@spaces.first
|
||||
else
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue