Class: Skunk::Command::CompareScore
- Inherits:
-
Object
- Object
- Skunk::Command::CompareScore
- Defined in:
- lib/skunk/commands/compare_score.rb
Overview
Knows how to describe score evolution between two branches
Instance Method Summary collapse
-
#initialize(base_branch, feature_branch, base_branch_score, feature_branch_score) ⇒ CompareScore
constructor
A new instance of CompareScore.
- #message ⇒ Object
- #score_evolution ⇒ Object
- #score_evolution_appreciation ⇒ Object
- #score_evolution_message ⇒ Object
Constructor Details
#initialize(base_branch, feature_branch, base_branch_score, feature_branch_score) ⇒ CompareScore
Returns a new instance of CompareScore.
8 9 10 11 12 13 |
# File 'lib/skunk/commands/compare_score.rb', line 8 def initialize(base_branch, feature_branch, base_branch_score, feature_branch_score) @base_branch = base_branch @feature_branch = feature_branch @base_branch_score = base_branch_score @feature_branch_score = feature_branch_score end |
Instance Method Details
#message ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/skunk/commands/compare_score.rb', line 15 def "Base branch (#{@base_branch}) "\ "average skunk score: #{@base_branch_score} \n"\ "Feature branch (#{@feature_branch}) "\ "average skunk score: #{@feature_branch_score} \n"\ "#{}" end |
#score_evolution ⇒ Object
31 32 33 34 35 36 |
# File 'lib/skunk/commands/compare_score.rb', line 31 def score_evolution return "Infinitely" if @base_branch_score.zero? precentage = (100 * (@base_branch_score - @feature_branch_score) / @base_branch_score) "#{precentage.round(0).abs}%" end |
#score_evolution_appreciation ⇒ Object
27 28 29 |
# File 'lib/skunk/commands/compare_score.rb', line 27 def score_evolution_appreciation @feature_branch_score > @base_branch_score ? "worse" : "better" end |
#score_evolution_message ⇒ Object
23 24 25 |
# File 'lib/skunk/commands/compare_score.rb', line 23 def "Skunk score average is #{score_evolution} #{score_evolution_appreciation} \n" end |