class Utils::LineBlamer
def self.blame(line)
def self.blame(line) blamer = for_line(line) if blame = blamer.perform blame.sub!(/^[0-9a-f^]+/) { Term::ANSIColor.yellow($&) } blame.sub!(/\(([^)]+)\)/) { "(#{Term::ANSIColor.red($1)})" } end end
def self.for_line(line)
def self.for_line(line) location = line.source_location and new *location end
def initialize(file, lineno = 1)
def initialize(file, lineno = 1) @file, @lineno = file, lineno end
def perform(options = '')
def perform(options = '') `git 2>/dev/null blame #{options} -L #@lineno,+1 "#@file"`.full? end