Class: Augit::Branch

Inherits:
Object
  • Object
show all
Defined in:
lib/augit/branch.rb

Constant Summary collapse

CHANGE_MAP =
[
  { name: 'commit',    regex: /^commit\s(.*)/ },
  { name: 'author',    regex: /^Author:\s(.*)\s</ },
  { name: 'timestamp', regex: /^Date:\s*(.*)$/ },
  { name: 'file',      regex: /^:.*\s(.*)/ }
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, origin) ⇒ Branch

Returns a new instance of Branch.



14
15
16
17
18
19
20
21
# File 'lib/augit/branch.rb', line 14

def initialize(name, origin)
  @name = name
  @origin = origin
  @commits = {}
  @age = Time.now

  populate
end

Instance Attribute Details

#ageObject (readonly)

Returns the value of attribute age.



5
6
7
# File 'lib/augit/branch.rb', line 5

def age
  @age
end

#authorObject (readonly)

Returns the value of attribute author.



5
6
7
# File 'lib/augit/branch.rb', line 5

def author
  @author
end

#commitsObject (readonly)

Returns the value of attribute commits.



5
6
7
# File 'lib/augit/branch.rb', line 5

def commits
  @commits
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/augit/branch.rb', line 5

def name
  @name
end

#originObject (readonly)

Returns the value of attribute origin.



5
6
7
# File 'lib/augit/branch.rb', line 5

def origin
  @origin
end

Instance Method Details

#commit_countObject



31
32
33
# File 'lib/augit/branch.rb', line 31

def commit_count
  commits.keys.length
end

#compare_urlObject



23
24
25
# File 'lib/augit/branch.rb', line 23

def compare_url
  "https://github.com/#{origin}/compare/#{name}"
end

#filesObject



27
28
29
# File 'lib/augit/branch.rb', line 27

def files
  commits.values.flatten.uniq
end