class PnoteClient::Documents::Pnote::Problem
Attributes
explaination[RW]
question[RW]
teacher_comments[RW]
tip[RW]
Public Class Methods
new( question: nil, answer: nil, explaination: nil, choices: nil, teacher_comments: [], tip: nil )
click to toggle source
# File lib/pnote_client/documents/pnote/problem.rb, line 12 def initialize( question: nil, answer: nil, explaination: nil, choices: nil, teacher_comments: [], tip: nil ) @question, @answer, @explaination, @choices, @teacher_comments, @tip = question, answer, explaination, choices, teacher_comments, tip @choice = nil @answer_line = nil end
Public Instance Methods
add_answer_line(new_line)
click to toggle source
# File lib/pnote_client/documents/pnote/problem.rb, line 27 def add_answer_line(new_line) @answer_line = add_line(@answer_line, new_line) end
add_choice_line(new_line)
click to toggle source
# File lib/pnote_client/documents/pnote/problem.rb, line 35 def add_choice_line(new_line) @choice = add_line(@choice, new_line) end
add_explaination_line(new_line)
click to toggle source
# File lib/pnote_client/documents/pnote/problem.rb, line 31 def add_explaination_line(new_line) @explaination = add_line(@explaination, new_line) end
add_question_line(new_line)
click to toggle source
# File lib/pnote_client/documents/pnote/problem.rb, line 23 def add_question_line(new_line) @question = add_line(@question, new_line) end
add_teacher_comment(new_teacher_comment)
click to toggle source
# File lib/pnote_client/documents/pnote/problem.rb, line 52 def add_teacher_comment(new_teacher_comment) @teacher_comments << new_teacher_comment end
add_tip_line(new_line)
click to toggle source
# File lib/pnote_client/documents/pnote/problem.rb, line 56 def add_tip_line(new_line) @tip = add_line(@tip, new_line) end
answer()
click to toggle source
# File lib/pnote_client/documents/pnote/problem.rb, line 39 def answer return @answer if @answer return @answer_line&.match(/\s*\[정답\]\s*(.*)/).to_a[1]&.strip end
choices()
click to toggle source
# File lib/pnote_client/documents/pnote/problem.rb, line 44 def choices return @choices if @choices return [] if @choice.nil? choice_number_pattern = /①|②|③|④|⑤/ return @choice.split(choice_number_pattern).map {|el| el.strip }.reject {|el| el.empty? } end