Class: RuboCop::Git::Commit

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

Overview

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Commit

Returns a new instance of Commit.



7
8
9
# File 'lib/rubocop/git/commit.rb', line 7

def initialize(options)
  @options = options
end

Instance Method Details

#file_content(filename) ⇒ Object



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

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