Class: QuestionSorter
- Inherits:
-
Object
- Object
- QuestionSorter
- Defined in:
- app/models/surveyform.rb
Instance Method Summary collapse
-
#initialize ⇒ QuestionSorter
constructor
A new instance of QuestionSorter.
- #push(id, survey_section_id) ⇒ Object
- #rearrange(survey_sections) ⇒ Object
Constructor Details
#initialize ⇒ QuestionSorter
Returns a new instance of QuestionSorter.
63 64 65 66 67 |
# File 'app/models/surveyform.rb', line 63 def initialize @sorting_hash = {} @display_order = 0 @qoffset = 0 end |
Instance Method Details
#push(id, survey_section_id) ⇒ Object
69 70 71 72 |
# File 'app/models/surveyform.rb', line 69 def push(id, survey_section_id) @sorting_hash[id.to_s] = {survey_section_id: survey_section_id, display_order: @display_order} _increment_display_order end |
#rearrange(survey_sections) ⇒ Object
74 75 76 77 78 79 80 |
# File 'app/models/surveyform.rb', line 74 def rearrange(survey_sections) survey_sections.each do |survey_section| survey_section.each do |question| _update_question(survey_section, question) end end end |