class GithubToCanvasQuiz::Model::Answer::ShortAnswer
Attributes
comments[RW]
id[RW]
text[RW]
title[RW]
Public Class Methods
new(options)
click to toggle source
# File lib/github_to_canvas_quiz/model/answer/short_answer.rb, line 9 def initialize(options) options.each do |key, value| send("#{key}=", value) if respond_to?("#{key}=") end end
Public Instance Methods
to_h()
click to toggle source
# File lib/github_to_canvas_quiz/model/answer/short_answer.rb, line 23 def to_h { 'answer_text' => text, 'answer_weight' => title == 'Correct' ? 100 : 0, 'answer_comment_html' => comments, 'id' => id }.reject { |_,v| v.nil? } end
to_markdown()
click to toggle source
# File lib/github_to_canvas_quiz/model/answer/short_answer.rb, line 15 def to_markdown MarkdownBuilder.build do |md| md.h2(title) md.p(text) md.blockquote(md.html_to_markdown(comments)) unless comments.empty? end end