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



15
16
17
18
19
20
21
22
23
# File 'lib/git_snip/branch.rb', line 15

def self.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



5
6
7
8
9
10
11
12
13
# File 'lib/git_snip/branch.rb', line 5

def self.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