Class: GithubToCanvasQuiz::Model::Answer::MultipleDropdowns
- Inherits:
-
Object
- Object
- GithubToCanvasQuiz::Model::Answer::MultipleDropdowns
- Defined in:
- lib/github_to_canvas_quiz/model/answer/multiple_dropdowns.rb
Instance Attribute Summary collapse
-
#blank_id ⇒ Object
Returns the value of attribute blank_id.
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#id ⇒ Object
Returns the value of attribute id.
-
#text ⇒ Object
Returns the value of attribute text.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(options) ⇒ MultipleDropdowns
constructor
A new instance of MultipleDropdowns.
- #to_h ⇒ Object
- #to_markdown ⇒ Object
Constructor Details
#initialize(options) ⇒ MultipleDropdowns
Returns a new instance of MultipleDropdowns.
9 10 11 12 13 |
# File 'lib/github_to_canvas_quiz/model/answer/multiple_dropdowns.rb', line 9 def initialize() .each do |key, value| send("#{key}=", value) if respond_to?("#{key}=") end end |
Instance Attribute Details
#blank_id ⇒ Object
Returns the value of attribute blank_id.
7 8 9 |
# File 'lib/github_to_canvas_quiz/model/answer/multiple_dropdowns.rb', line 7 def blank_id @blank_id end |
#comments ⇒ Object
Returns the value of attribute comments.
7 8 9 |
# File 'lib/github_to_canvas_quiz/model/answer/multiple_dropdowns.rb', line 7 def comments @comments end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/github_to_canvas_quiz/model/answer/multiple_dropdowns.rb', line 7 def id @id end |
#text ⇒ Object
Returns the value of attribute text.
7 8 9 |
# File 'lib/github_to_canvas_quiz/model/answer/multiple_dropdowns.rb', line 7 def text @text end |
#title ⇒ Object
Returns the value of attribute title.
7 8 9 |
# File 'lib/github_to_canvas_quiz/model/answer/multiple_dropdowns.rb', line 7 def title @title end |
Instance Method Details
#to_h ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/github_to_canvas_quiz/model/answer/multiple_dropdowns.rb', line 23 def to_h { 'answer_text' => text, 'answer_weight' => title == 'Correct' ? 100 : 0, 'answer_comment_html' => comments, 'blank_id' => blank_id, 'id' => id }.reject { |_,v| v.nil? } end |
#to_markdown ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/github_to_canvas_quiz/model/answer/multiple_dropdowns.rb', line 15 def to_markdown MarkdownBuilder.build do |md| md.h2(title) md.ul(text, blank_id) md.blockquote(md.html_to_markdown(comments)) unless comments.empty? end end |