Class: Utils::LineBlamer

Inherits:
Object show all
Defined in:
lib/utils/line_blamer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, lineno = 1) ⇒ LineBlamer

Returns a new instance of LineBlamer.



3
4
5
# File 'lib/utils/line_blamer.rb', line 3

def initialize(file, lineno = 1)
  @file, @lineno = file, lineno
end

Class Method Details

.for_line(line) ⇒ Object



7
8
9
# File 'lib/utils/line_blamer.rb', line 7

def self.for_line(line)
  location = line.source_location and new(*location)
end

Instance Method Details

#perform(options = '') ⇒ Object



11
12
13
# File 'lib/utils/line_blamer.rb', line 11

def perform(options = '')
  `git 2>/dev/null blame #{options} -L #@lineno,+1 "#@file"`.full?
end