Class: RuboCop::Git::Commit

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/git/commit.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Commit



5
6
7
# File 'lib/rubocop/git/commit.rb', line 5

def initialize(options)
  @options = options
end

Instance Method Details

#file_content(filename) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/rubocop/git/commit.rb', line 9

def file_content(filename)
  if @options.cached
    `git show :#{filename.shellescape}`
  elsif @options.commit_last
    `git show #{@options.commit_last.shellescape}:#{filename.shellescape}`
  else
    File.read(filename)
  end
end