Class: Quby::Questionnaires::Entities::SubscoreSchema

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/quby/questionnaires/entities/subscore_schema.rb

Overview

SubscoreSchema instances describe each key that could be returned in a score result hash

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#export_keyObject

The shortened key that will used as the field/column name for csv and oru exports, excluding the questionnaire key part



15
16
17
# File 'lib/quby/questionnaires/entities/subscore_schema.rb', line 15

def export_key
  @export_key
end

#keyObject

The key this subscore has in the hash returned by the score



10
11
12
# File 'lib/quby/questionnaires/entities/subscore_schema.rb', line 10

def key
  @key
end

#labelObject

The description of this subscore in the context of the score, like ‘Mean’, ‘T-Score’ or ‘Interpretation’



12
13
14
# File 'lib/quby/questionnaires/entities/subscore_schema.rb', line 12

def label
  @label
end

#only_for_exportObject

Whether this score will only be exported through oru/api/data exports, but not shown in interfaces



17
18
19
# File 'lib/quby/questionnaires/entities/subscore_schema.rb', line 17

def only_for_export
  @only_for_export
end

Instance Method Details

#export_key_is_symbolObject



27
28
29
# File 'lib/quby/questionnaires/entities/subscore_schema.rb', line 27

def export_key_is_symbol
  errors.add(:export_key, 'is not a symbol') unless export_key.is_a?(Symbol)
end

#key_is_symbolObject



23
24
25
# File 'lib/quby/questionnaires/entities/subscore_schema.rb', line 23

def key_is_symbol
  errors.add(:key, 'is not a symbol') unless key.is_a?(Symbol)
end