class GithubToCanvasQuiz::Model::Answer::MultipleChoice

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/multiple_choice.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/multiple_choice.rb, line 23
def to_h
  {
    'answer_html' => 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/multiple_choice.rb, line 15
def to_markdown
  MarkdownBuilder.build do |md|
    md.h2(title)
    md.md(md.html_to_markdown(text))
    md.blockquote(md.html_to_markdown(comments)) unless comments.empty?
  end
end