Sha256: 6b3d96ace14b48d921efb647ae36c4cafcfb2e925110008f72fe26de5c0bfa8f

Contents?: true

Size: 695 Bytes

Versions: 4

Compression:

Stored size: 695 Bytes

Contents

module Inch
  module Evaluation
    class ScoreRange < Struct.new(:range, :grade, :description, :color, :bg_color)
      # Returns code_objects that received a score with the defined +range+
      attr_reader :objects

      def objects=(arr)
        arr.each { |o| o.grade = grade }
        @objects = arr
      end
    end

    SCORE_RANGE_ARGS = [
      [80..100, :A, "Seems really good", :green],
      [50...80, :B, "Proper documentation present", :yellow],
      [1...50,  :C, "Needs work", :red],
      [0..0,    :U, "Undocumented", :color141, :color105],
    ]

    def self.new_score_ranges
      SCORE_RANGE_ARGS.map do |args|
        ScoreRange.new(*args)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inch-0.1.3 lib/inch/evaluation/score_range.rb
inch-0.1.2 lib/inch/evaluation/score_range.rb
inch-0.1.1 lib/inch/evaluation/score_range.rb
inch-0.1.0 lib/inch/evaluation/score_range.rb