class AnalDiffist::FlogProblem

Attributes

context[RW]
score[RW]

Public Class Methods

new(class_method, score, threshold = 10) click to toggle source
# 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

Public Instance Methods

description() click to toggle source
# File lib/analdiffist/flog_parser.rb, line 42
def description
  "Flog: #{score}"
end
diff(other) click to toggle source
# 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() click to toggle source
# File lib/analdiffist/flog_parser.rb, line 28
def type
  'flog score'
end