Class: Greenroom::CLI::Judge::Patch
- Inherits:
-
Object
- Object
- Greenroom::CLI::Judge::Patch
- Defined in:
- lib/greenroom/cli/judge.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(repository, experiment, verdict) ⇒ Patch
constructor
A new instance of Patch.
Constructor Details
#initialize(repository, experiment, verdict) ⇒ Patch
Returns a new instance of Patch.
195 196 197 198 199 |
# File 'lib/greenroom/cli/judge.rb', line 195 def initialize(repository, experiment, verdict) @repository = repository @experiment = experiment @verdict = verdict end |
Instance Method Details
#call ⇒ Object
201 202 203 204 205 206 207 208 209 210 |
# File 'lib/greenroom/cli/judge.rb', line 201 def call matches = find_matches # Multiple locations make the patch target ambiguous. The judge stops # instead of changing a location that it cannot identify safely. return [nil, "The experiment has #{matches.length} locations."] unless matches.one? path, source, match = matches.first changed = (@verdict == "go") ? promote(source, match) : revert(source, match) build(path, source, changed) end |