Class: Senkyoshi::Answer

Inherits:
Resource show all
Defined in:
lib/senkyoshi/models/answer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_textObject (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

#feedbackObject

Returns the value of attribute feedback.



21
22
23
# File 'lib/senkyoshi/models/answer.rb', line 21

def feedback
  @feedback
end

#fractionObject

Returns the value of attribute fraction.



21
22
23
# File 'lib/senkyoshi/models/answer.rb', line 21

def fraction
  @fraction
end

#idObject (readonly)

Returns the value of attribute id.



20
21
22
# File 'lib/senkyoshi/models/answer.rb', line 20

def id
  @id
end

#resp_identObject

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_xmlObject



32
33
34
# File 'lib/senkyoshi/models/answer.rb', line 32

def iterate_xml
  self
end