Class: AnalDiffist::FlogProblem
- Inherits:
-
Object
- Object
- AnalDiffist::FlogProblem
- 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 ⇒ Object
- #diff(other) ⇒ Object
-
#initialize(class_method, score, threshold = 10) ⇒ FlogProblem
constructor
A new instance of FlogProblem.
- #type ⇒ Object
Constructor Details
#initialize(class_method, score, threshold = 10) ⇒ FlogProblem
Returns a new instance of FlogProblem.
22 23 24 25 26 |
# File 'lib/analdiffist/flog_parser.rb', line 22 def initialize class_method, score, threshold = 10 @context = class_method || '(none)' @score = score.round(1) @flog_threshold = threshold end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
21 22 23 |
# File 'lib/analdiffist/flog_parser.rb', line 21 def context @context end |
#score ⇒ Object
Returns the value of attribute score.
21 22 23 |
# File 'lib/analdiffist/flog_parser.rb', line 21 def score @score end |
Instance Method Details
#description ⇒ Object
42 43 44 |
# File 'lib/analdiffist/flog_parser.rb', line 42 def description "Flog: #{score}" end |
#diff(other) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/analdiffist/flog_parser.rb', line 32 def diff other if other.nil? return nil if score < @flog_threshold return FlogDiff.new(@context, 0, score) end return nil if other.score == score return nil if score < @flog_threshold && other.score < @flog_threshold FlogDiff.new(@context, other.score, score) end |
#type ⇒ Object
28 29 30 |
# File 'lib/analdiffist/flog_parser.rb', line 28 def type 'flog score' end |