class PnoteClient::Validators::Validator

Public Class Methods

new() click to toggle source
# File lib/pnote_client/validators/validator.rb, line 10
def initialize
  @errors = []
end

Public Instance Methods

error_count() click to toggle source
# File lib/pnote_client/validators/validator.rb, line 18
def error_count
  return @errors.length
end
has_error?() click to toggle source
# File lib/pnote_client/validators/validator.rb, line 14
def has_error?
  return error_count > 0
end

Protected Instance Methods

add_error(error_msg) click to toggle source
# File lib/pnote_client/validators/validator.rb, line 28
def add_error(error_msg)
  @errors << error_msg
end
make_error(title:, problem_number:, type:, detail: nil) click to toggle source
# File lib/pnote_client/validators/validator.rb, line 32
def make_error(title:, problem_number:, type:, detail: nil)
  return "[에러 메시지] #{title}\n" + 
    "[에러 위치] 문제 #{problem_number}번, 유형: (#{type})\n" +
    "[상세 내용]\n#{detail}"
end
reset_errors() click to toggle source
# File lib/pnote_client/validators/validator.rb, line 24
def reset_errors
  @errors = []
end