class GithubToCanvasQuiz::Model::Answer::MultipleDropdowns

Attributes

blank_id[RW]
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_dropdowns.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_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() click to toggle source
# 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