Class: Calcifer::Finders::FilesBranchDiffFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/calcifer/finders/files_branch_diff_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(branch) ⇒ FilesBranchDiffFinder

Returns a new instance of FilesBranchDiffFinder.



6
7
8
# File 'lib/calcifer/finders/files_branch_diff_finder.rb', line 6

def initialize(branch)
  @branch = branch
end

Instance Method Details

#executeObject



10
11
12
13
14
15
# File 'lib/calcifer/finders/files_branch_diff_finder.rb', line 10

def execute
  @file_list = git_files.split.map(&lambda { |file_path|
    file = File.open(file_path)
    file if file.size.positive? && File.extname(file.path) == '.rb'
  }).compact
end

#git_filesObject



17
18
19
# File 'lib/calcifer/finders/files_branch_diff_finder.rb', line 17

def git_files
  `git diff --name-only #{@branch}...`
end