Class: Shark::FormService::Form::RatingScale

Inherits:
Element
  • Object
show all
Defined in:
lib/shark/form_service/form/rating_scale.rb

Instance Attribute Summary

Attributes inherited from Element

#children, #parent

Instance Method Summary collapse

Methods inherited from Element

#ancestors, #attribute_defined?, #attribute_definition, #attribute_definitions, #id, #initialize, #label, #text, #type

Constructor Details

This class inherits a constructor from Shark::FormService::Form::Element

Instance Method Details

#valuesObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/shark/form_service/form/rating_scale.rb', line 7

def values
  scale_start = element['scale_start'].to_i
  scale_end = element['scale_end'].to_i
  allow_no_information = element['allow_no_information']

  scale_values = (scale_start..scale_end).to_a
  scale_values << -1 if allow_no_information == true

  scale_values
end