Class: QuestionGroupTracker
- Inherits:
-
Object
- Object
- QuestionGroupTracker
- Defined in:
- app/models/question_group_tracker.rb
Instance Attribute Summary collapse
-
#question_group ⇒ Object
readonly
Returns the value of attribute question_group.
-
#question_group_id ⇒ Object
readonly
Returns the value of attribute question_group_id.
-
#questions ⇒ Object
readonly
Returns the value of attribute questions.
Instance Method Summary collapse
- #check_for_new_group(question) ⇒ Object
-
#initialize(question_group_id) ⇒ QuestionGroupTracker
constructor
A new instance of QuestionGroupTracker.
Constructor Details
#initialize(question_group_id) ⇒ QuestionGroupTracker
Returns a new instance of QuestionGroupTracker.
3 4 5 6 7 8 |
# File 'app/models/question_group_tracker.rb', line 3 def initialize(question_group_id) @questions = Question.where('question_group_id=?',question_group_id) @counter = 0 @question_group_id = question_group_id @question_group = QuestionGroup.find(question_group_id) end |
Instance Attribute Details
#question_group ⇒ Object (readonly)
Returns the value of attribute question_group.
2 3 4 |
# File 'app/models/question_group_tracker.rb', line 2 def question_group @question_group end |
#question_group_id ⇒ Object (readonly)
Returns the value of attribute question_group_id.
2 3 4 |
# File 'app/models/question_group_tracker.rb', line 2 def question_group_id @question_group_id end |
#questions ⇒ Object (readonly)
Returns the value of attribute questions.
2 3 4 |
# File 'app/models/question_group_tracker.rb', line 2 def questions @questions end |
Instance Method Details
#check_for_new_group(question) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/models/question_group_tracker.rb', line 10 def check_for_new_group(question) if question.question_group_id != @question_group_id || !defined?(@initial_check) initialize(question.question_group_id) @initial_check = true return true else return false end end |