Class: ChurnVsComplexity::Timetravel::Worker
- Inherits:
-
Object
- Object
- ChurnVsComplexity::Timetravel::Worker
- Defined in:
- lib/churn_vs_complexity/timetravel.rb
Instance Method Summary collapse
-
#initialize(engine:, worktree:) ⇒ Worker
constructor
A new instance of Worker.
- #schedule(chunk:, pipe:) ⇒ Object
Constructor Details
#initialize(engine:, worktree:) ⇒ Worker
47 48 49 50 |
# File 'lib/churn_vs_complexity/timetravel.rb', line 47 def initialize(engine:, worktree:) @engine = engine @worktree = worktree end |
Instance Method Details
#schedule(chunk:, pipe:) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/churn_vs_complexity/timetravel.rb', line 52 def schedule(chunk:, pipe:) fork do results = chunk.to_h do |commit| sha = commit.sha @worktree.checkout(sha) result = @engine.check(folder: @worktree.folder) [sha, result] end @worktree.remove pipe[1].puts(JSON.dump(results)) pipe[1].close end end |