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
#_find_directories, #_fix_path, #_matches_directory_xid?, #_search_and_replace, #cleanup, #fix_html, get_pre_data, #matches_xid?, #strip_xid
Constructor Details
#initialize(text, id = Senkyoshi.create_random_hex) ⇒ Answer
Returns a new instance of Answer.
23 24 25 26 27 28 29 30 |
# File 'lib/senkyoshi/models/answer.rb', line 23 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.
20 21 22 |
# File 'lib/senkyoshi/models/answer.rb', line 20 def answer_text @answer_text end |
#feedback ⇒ Object
Returns the value of attribute feedback.
21 22 23 |
# File 'lib/senkyoshi/models/answer.rb', line 21 def feedback @feedback end |
#fraction ⇒ Object
Returns the value of attribute fraction.
21 22 23 |
# File 'lib/senkyoshi/models/answer.rb', line 21 def fraction @fraction end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
20 21 22 |
# File 'lib/senkyoshi/models/answer.rb', line 20 def id @id end |
#resp_ident ⇒ Object
Returns the value of attribute resp_ident.
21 22 23 |
# File 'lib/senkyoshi/models/answer.rb', line 21 def resp_ident @resp_ident end |
Instance Method Details
#canvas_conversion(question, resources) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/senkyoshi/models/answer.rb', line 36 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
32 33 34 |
# File 'lib/senkyoshi/models/answer.rb', line 32 def iterate_xml self end |