Sha256: c973f938ecaf27db9cf8e3640818f1b98b75ce6fb36136324c5780f7713fe5ec

Contents?: true

Size: 879 Bytes

Versions: 36

Compression:

Stored size: 879 Bytes

Contents

module Inch
  module Evaluation
    # These objects associate a grade with a group of objects
    #
    # @see .new_grade_lists
    class GradeList < Struct.new(:grade)
      extend Forwardable

      def_delegators :grade,
                     :scores, :label, :color, :bg_color, :to_s, :to_sym

      # Returns code_objects that received a score with the defined +scores+
      attr_reader :objects

      # Assigns code_objects that received a score with the defined +scores+
      #
      # @param arr [Array<CodeObject::Proxy>]
      # @return [Array<CodeObject::Proxy>]
      def objects=(arr)
        arr.each { |o| o.grade = grade }
        @objects = arr
      end
    end

    # Returns newly instanciated grade range objects
    #
    # @return [Array<GradeList>]
    def self.new_grade_lists
      Evaluation::Grade.all.map { |g| GradeList.new(g) }
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
inch-0.5.7 lib/inch/evaluation/grade_list.rb
inch-0.5.6 lib/inch/evaluation/grade_list.rb
inch-0.5.5 lib/inch/evaluation/grade_list.rb
inch-0.5.4 lib/inch/evaluation/grade_list.rb
inch-0.5.3 lib/inch/evaluation/grade_list.rb
inch-0.5.2 lib/inch/evaluation/grade_list.rb
inch-0.5.1 lib/inch/evaluation/grade_list.rb
inch-0.5.0 lib/inch/evaluation/grade_list.rb
inch-0.5.0.rc11 lib/inch/evaluation/grade_list.rb
inch-0.5.0.rc10 lib/inch/evaluation/grade_list.rb
inch-0.5.0.rc9 lib/inch/evaluation/grade_list.rb
inch-0.5.0.rc8 lib/inch/evaluation/grade_list.rb
inch-0.5.0.rc7 lib/inch/evaluation/grade_list.rb
inch-0.5.0.rc6 lib/inch/evaluation/grade_list.rb
inch-0.5.0.rc5 lib/inch/evaluation/grade_list.rb
inch-0.5.0.rc4 lib/inch/evaluation/grade_list.rb