Module: GitSnip::Branch

Defined in:
lib/git_snip/branch.rb

Defined Under Namespace

Classes: Row

Class Method Summary collapse

Class Method Details

.full_row(branch) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/git_snip/branch.rb', line 20

def full_row(branch)
  Row.new.tap do |row|
    row.sha = branch.gcommit.sha
    row.name = branch.name
    row.date = branch.gcommit.date.iso8601
    row.author = branch.gcommit.author.email
    row.message = first_line(branch.gcommit.message)
  end
end

.row(branch) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/git_snip/branch.rb', line 10

def row(branch)
  Row.new.tap do |row|
    row.sha = column(branch.gcommit.sha, 7)
    row.name = column(branch.name, 12)
    row.date = column(branch.gcommit.date.strftime('%F'), 10)
    row.author = column(branch.gcommit.author.email.sub(/@.*/, ''), 8)
    row.message = column(first_line(branch.gcommit.message), 39)
  end
end