Class: Senkyoshi::Answer
- Defined in:
- lib/senkyoshi/models/answer.rb
Instance Attribute Summary collapse
-
#answer_text ⇒ Object
readonly
Returns the value of attribute answer_text.
-
#feedback ⇒ Object
Returns the value of attribute feedback.
-
#fraction ⇒ Object
Returns the value of attribute fraction.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#resp_ident ⇒ Object
Returns the value of attribute resp_ident.
Instance Method Summary collapse
- #canvas_conversion(question, resources) ⇒ Object
-
#initialize(text, id = Senkyoshi.create_random_hex) ⇒ Answer
constructor
A new instance of Answer.
- #iterate_xml ⇒ Object
Methods inherited from Resource
#_search_and_replace, #cleanup, #fix_html, #matches_xid?
Constructor Details
#initialize(text, id = Senkyoshi.create_random_hex) ⇒ Answer
Returns a new instance of Answer.
8 9 10 11 12 13 14 15 |
# File 'lib/senkyoshi/models/answer.rb', line 8 def initialize(text, id = Senkyoshi.create_random_hex) @answer_text = text @resp_ident = "" @fraction = "" @feedback = "" @points = 0 @id = id end |
Instance Attribute Details
#answer_text ⇒ Object (readonly)
Returns the value of attribute answer_text.
5 6 7 |
# File 'lib/senkyoshi/models/answer.rb', line 5 def answer_text @answer_text end |
#feedback ⇒ Object
Returns the value of attribute feedback.
6 7 8 |
# File 'lib/senkyoshi/models/answer.rb', line 6 def feedback @feedback end |
#fraction ⇒ Object
Returns the value of attribute fraction.
6 7 8 |
# File 'lib/senkyoshi/models/answer.rb', line 6 def fraction @fraction end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/senkyoshi/models/answer.rb', line 5 def id @id end |
#resp_ident ⇒ Object
Returns the value of attribute resp_ident.
6 7 8 |
# File 'lib/senkyoshi/models/answer.rb', line 6 def resp_ident @resp_ident end |
Instance Method Details
#canvas_conversion(question, resources) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/senkyoshi/models/answer.rb', line 21 def canvas_conversion(question, resources) answer = CanvasCc::CanvasCC::Models::Answer.new(@answer_text) answer.answer_text = fix_html(@answer_text, resources) answer.id = @id answer.fraction = @fraction answer.feedback = @feedback answer.resp_ident = @resp_ident question.answers << answer question end |
#iterate_xml ⇒ Object
17 18 19 |
# File 'lib/senkyoshi/models/answer.rb', line 17 def iterate_xml self end |