class GithubToCanvasQuiz::Model::Answer::Matching

Attributes

comments[RW]
id[RW]
left[RW]
right[RW]
text[RW]
title[RW]

Public Class Methods

new(options) click to toggle source
# File lib/github_to_canvas_quiz/model/answer/matching.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/matching.rb, line 23
def to_h
  {
    'answer_text' => left,
    'answer_weight' => 100,
    'answer_comment_html' => comments,
    'answer_match_left' => left,
    'answer_match_right' => right,
    'id' => id
  }.reject { |_,v| v.nil? }
end
to_markdown() click to toggle source
# File lib/github_to_canvas_quiz/model/answer/matching.rb, line 15
def to_markdown
  MarkdownBuilder.build do |md|
    md.h2(title)
    md.ul(left, right)
    md.blockquote(md.html_to_markdown(comments)) unless comments.empty?
  end
end