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

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

#feedbackObject

Returns the value of attribute feedback.



6
7
8
# File 'lib/senkyoshi/models/answer.rb', line 6

def feedback
  @feedback
end

#fractionObject

Returns the value of attribute fraction.



6
7
8
# File 'lib/senkyoshi/models/answer.rb', line 6

def fraction
  @fraction
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/senkyoshi/models/answer.rb', line 5

def id
  @id
end

#resp_identObject

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_xmlObject



17
18
19
# File 'lib/senkyoshi/models/answer.rb', line 17

def iterate_xml
  self
end