class Precious::Views::Commit

Attributes

version[R]

Public Instance Methods

author() click to toggle source
# File lib/gollum/views/commit.rb, line 13
def author
  @commit.author.name
end
authored_date() click to toggle source
# File lib/gollum/views/commit.rb, line 17
def authored_date
  @commit.authored_date
end
datetime() click to toggle source
# File lib/gollum/views/commit.rb, line 21
def datetime
  authored_date.utc.iso8601
end
files() click to toggle source
# File lib/gollum/views/commit.rb, line 29
def files
  files = @diff.force_encoding(Encoding::UTF_8).scan(%r{
    ^diff\ --git\         # diff start
    .+?                   # diff body
    (?=^diff\ --git|\Z)   # scan until next diff or string
  }sxmu)

  files.map do |diff|
    match = diff.match(%r{^diff --git (")?[ab]/(.+)(?(1)") (")?[ab]/(.+)(?(3)")})
    path = match[2]
    path = match[4] if path.nil?

    {
      path: path,
      lines: lines(diff)
    }
  end
end
message() click to toggle source
# File lib/gollum/views/commit.rb, line 25
def message
  @commit.message
end
title() click to toggle source
# File lib/gollum/views/commit.rb, line 9
def title
  "Changes in #{@version[0..6]}: #{message}"
end