class Utils::LineBlamer

def self.for_line(line)

Returns:
  • (Utils::LineBlamer, nil) - a new LineBlamer instance if the line

Parameters:
  • line (Object) -- the line object to analyze for source location
def self.for_line(line)
  location = line.source_location and new(*location)
end

def initialize(file, lineno = 1)

Parameters:
  • lineno (Integer) -- the line number within the file (defaults to 1)
  • file (String) -- the path to the file containing the line of code
def initialize(file, lineno = 1)
  @file, @lineno = file, lineno
end

def perform(options = '')

Returns:
  • (String, nil) - the output of the git blame command if successful, otherwise nil

Parameters:
  • options (String) -- additional options to pass to the git blame command
def perform(options = '')
  `git 2>/dev/null blame #{options} -L #@lineno,+1 "#@file"`.full?
end