Sha256: 36bc9e23bf5f738b8e250a99d1057f74b0f64c7eee4ea01fb0cd0960f38fd53d

Contents?: true

Size: 900 Bytes

Versions: 37

Compression:

Stored size: 900 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::Base>]
      # @return [Array<CodeObject::Proxy::Base>]
      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

37 entries across 37 versions & 1 rubygems

Version Path
inch-0.5.0.rc3 lib/inch/evaluation/grade_list.rb
inch-0.5.0.rc2 lib/inch/evaluation/grade_list.rb
inch-0.5.0.rc1 lib/inch/evaluation/grade_list.rb
inch-0.4.6 lib/inch/evaluation/grade_list.rb
inch-0.4.5 lib/inch/evaluation/grade_list.rb
inch-0.4.4 lib/inch/evaluation/grade_list.rb
inch-0.4.4.rc4 lib/inch/evaluation/grade_list.rb
inch-0.4.4.rc3 lib/inch/evaluation/grade_list.rb
inch-0.4.4.rc2 lib/inch/evaluation/grade_list.rb
inch-0.4.4.rc1 lib/inch/evaluation/grade_list.rb
inch-0.4.3 lib/inch/evaluation/grade_list.rb
inch-0.4.3.rc2 lib/inch/evaluation/grade_list.rb
inch-0.4.3.rc1 lib/inch/evaluation/grade_list.rb
inch-0.4.2 lib/inch/evaluation/grade_list.rb
inch-0.4.1 lib/inch/evaluation/grade_list.rb
inch-0.4.0 lib/inch/evaluation/grade_list.rb
inch-0.4.0.rc3 lib/inch/evaluation/grade_list.rb
inch-0.4.0.rc2 lib/inch/evaluation/grade_list.rb
inch-0.4.0.rc1 lib/inch/evaluation/grade_list.rb
inch-0.3.4.rc1 lib/inch/evaluation/grade_list.rb