Class: StudyEngine::Answer

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/study_engine/answer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#question_responsesObject

Returns the value of attribute question_responses.



33
34
35
# File 'app/models/study_engine/answer.rb', line 33

def question_responses
  @question_responses
end

Instance Method Details

#questionObject



8
9
10
# File 'app/models/study_engine/answer.rb', line 8

def question
  CatEngine::Question.new(id: question_id, promis_id: question_promis_id, context: question_context, title: question_title, responses: [])
end

#question=(value) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'app/models/study_engine/answer.rb', line 12

def question= value
  self.response = value.selected_response
  value.each_pair do |key, value|
    if key == :response_before
      self.response_before = value
    else
      send :"question_#{key}=", value
    end
  end
end

#responseObject



23
24
25
# File 'app/models/study_engine/answer.rb', line 23

def response
  CatEngine::Response.new(id: response_id, promis_id: response_promis_id, before: response_before, title: response_title)
end

#response=(value) ⇒ Object



27
28
29
30
31
# File 'app/models/study_engine/answer.rb', line 27

def response= value
  value.each_pair do |key, value|
    send :"response_#{key}=", value
  end
end