Class: FilesInMyDiff::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/files_in_my_diff/resolver.rb

Instance Method Summary collapse

Constructor Details

#initialize(folder:, revision:, file_strategy: TmpDir::FileStrategy, git_strategy: nil) ⇒ Resolver

Returns a new instance of Resolver.



5
6
7
8
9
10
# File 'lib/files_in_my_diff/resolver.rb', line 5

def initialize(folder:, revision:, file_strategy: TmpDir::FileStrategy, git_strategy: nil)
  @folder = folder
  @revision = revision
  @file_strategy = file_strategy
  @git_strategy = git_strategy
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
# File 'lib/files_in_my_diff/resolver.rb', line 12

def call
  validate_folder!
  diff = git_strategy.diff(@revision)
  diff.validate!
  rd = @file_strategy.revision_dir(diff.sha)
  rd.create!
  git_strategy.checkout_worktree(rd.dir, diff.sha)
  rd.decorate(diff.changes)
end