Class: AnalDiffist::FlogDiff
- Inherits:
-
Object
- Object
- AnalDiffist::FlogDiff
- Defined in:
- lib/analdiffist/flog_parser.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#score ⇒ Object
Returns the value of attribute score.
Instance Method Summary collapse
- #description(mode = :added) ⇒ Object
-
#initialize(context, previous_score, current_score) ⇒ FlogDiff
constructor
A new instance of FlogDiff.
- #invert! ⇒ Object
Constructor Details
#initialize(context, previous_score, current_score) ⇒ FlogDiff
Returns a new instance of FlogDiff.
49 50 51 52 53 |
# File 'lib/analdiffist/flog_parser.rb', line 49 def initialize context, previous_score, current_score @context = context @current_score = current_score @previous_score = previous_score end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
48 49 50 |
# File 'lib/analdiffist/flog_parser.rb', line 48 def context @context end |
#score ⇒ Object
Returns the value of attribute score.
48 49 50 |
# File 'lib/analdiffist/flog_parser.rb', line 48 def score @score end |
Instance Method Details
#description(mode = :added) ⇒ Object
64 65 66 67 |
# File 'lib/analdiffist/flog_parser.rb', line 64 def description(mode = :added) indicator = (mode == :added) ? "+" : "" "Flog: #{@current_score.round(1)} (#{indicator}#{(@current_score - @previous_score).round(1)})" end |
#invert! ⇒ Object
59 60 61 62 |
# File 'lib/analdiffist/flog_parser.rb', line 59 def invert! score = 0 - (score || 0) self end |