Class: MetaCommit::Index::Commands::DiffExaminer

Inherits:
Object
  • Object
show all
Defined in:
lib/meta_commit/index/commands/diff_examiner.rb

Instance Method Summary collapse

Constructor Details

#initialize(parse_command, ast_path_factory, diff_factory) ⇒ DiffExaminer

Returns a new instance of DiffExaminer.



7
8
9
10
11
# File 'lib/meta_commit/index/commands/diff_examiner.rb', line 7

def initialize(parse_command, ast_path_factory, diff_factory)
  @parse_command = parse_command
  @ast_path_factory = ast_path_factory
  @diff_factory = diff_factory
end

Instance Method Details

#meta(repo) ⇒ MetaCommit::Models::Changes::Repository

Creates diff objects with meta information of changes in repository commits



16
17
18
19
20
21
22
23
24
25
# File 'lib/meta_commit/index/commands/diff_examiner.rb', line 16

def meta(repo)
  repo_changes = MetaCommit::Models::Changes::Repository.new(repo.path)
  repo.walk_by_commits do |left_commit, right_commit|
    commit_changes = MetaCommit::Models::Changes::Commit.new(left_commit.oid, right_commit.oid)
    diffs = examine_diff(repo, left_commit, right_commit)
    commit_changes.push_changes(diffs)
    repo_changes.push(commit_changes)
  end
  repo_changes
end