Sha256: f78f6fb1838d2cfd3e885b80842c7dad195fa8392e7f931000aae186fd084b5f

Contents?: true

Size: 875 Bytes

Versions: 2

Compression:

Stored size: 875 Bytes

Contents

module Quby
  module Answers
    module Entities
      # Subscore instances describe the subscore keys of answer#scores using score schema information.

      class Subscore
        attr_accessor :subschema

        # The key this subscore has in the hash returned by the score
        delegate :key, to: :subschema
        # The description of this subscore in the context of the score, like 'Mean', 'T-Score' or 'Interpretation'
        delegate :label, to: :subschema
        # The shortened key that will used as the field/column name for csv and oru exports,
        # excluding the questionnaire key part
        delegate :export_key, to: :subschema

        def initialize(subschema:, score_hash:)
          self.subschema = subschema
          @score_hash = score_hash
        end

        def value
          @score_hash[key]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
quby-5.6.5 lib/quby/answers/entities/subscore.rb
quby-5.6.3 lib/quby/answers/entities/subscore.rb