Class: GitXplorer::GitObject::File
Instance Attribute Summary
#name, #parent
Instance Method Summary
collapse
#absolute_path, #exist?, #get, #get_completions, #has_child?, #tab_complete, #to_s
Constructor Details
#initialize(name, parent) ⇒ File
Returns a new instance of File.
41
42
43
|
# File 'lib/git_xplorer/git_object/file.rb', line 41
def initialize(name, parent)
super(name, parent)
end
|
Instance Method Details
#children ⇒ Object
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
31
32
33
34
|
# File 'lib/git_xplorer/git_object/file.rb', line 2
def children
if (@kids.nil?)
@kids = Array.new
cmd = [
"git log --date=format-local:\"%F_%I:%M:%S_%P\"",
"--diff-filter=AC",
"--full-history",
"--pretty=tformat:\"{{%H}}{{%s}}{{%cd}}{{%an}}\"",
"--",
absolute_path
].join(" ")
%x(#{cmd}).split("\n").each do |line|
line.match(/{{(.+)}}{{(.+)}}{{(.+)}}{{(.+)}}/) do |m|
@kids.push(
GitXplorer::GitObject::Revision.new(
m[1],
self,
m[2],
m[3],
m[4]
)
)
end
end
end
return @kids
end
|
#desc ⇒ Object
36
37
38
39
|
# File 'lib/git_xplorer/git_object/file.rb', line 36
def desc
return "#{newest.name} #{newest.date}" if (newest)
return nil
end
|
#newest ⇒ Object
45
46
47
|
# File 'lib/git_xplorer/git_object/file.rb', line 45
def newest
return children[0]
end
|