class Renderror::BaseError

Public Class Methods

new(title: default_title, detail: default_detail, pointer: nil) click to toggle source
# File lib/renderror/base_error.rb, line 3
def initialize(title: default_title, detail: default_detail, pointer: nil)
  @title = title
  @detail = detail
  @pointer = pointer
end

Public Instance Methods

detail() click to toggle source
# File lib/renderror/base_error.rb, line 26
def detail
  @detail ||= I18n.t(:"renderror.base_error.detail")
end
pointer() click to toggle source
# File lib/renderror/base_error.rb, line 30
def pointer
  @pointer ||= nil
end
status() click to toggle source
# File lib/renderror/base_error.rb, line 18
def status
  @status ||= I18n.t(:"renderror.base_error.status")
end
title() click to toggle source
# File lib/renderror/base_error.rb, line 22
def title
  @title ||= I18n.t(:"renderror.base_error.title")
end
to_json() click to toggle source
# File lib/renderror/base_error.rb, line 9
def to_json
  Hash.new.tap do |hash|
    hash['status'] = status
    hash['title'] = title
    hash['detail'] = detail
    hash['source'] = { 'pointer' => pointer } if pointer
  end
end

Private Instance Methods

default_detail() click to toggle source
# File lib/renderror/base_error.rb, line 40
def default_detail
  I18n.t(:"renderror.base_error.detail")
end
default_title() click to toggle source
# File lib/renderror/base_error.rb, line 36
def default_title
  I18n.t(:"renderror.base_error.title")
end