class Blinkr::Error

Attributes

category[R]
code[R]
detail[R]
icon[R]
message[R]
severity[R]
snippet[R]
title[R]
type[R]
url[R]

Public Class Methods

new(opts = {}) click to toggle source
# File lib/blinkr/error.rb, line 6
def initialize (opts = {})
  raise TypeError 'severity must be a string or symbol' unless opts[:severity].is_a?(String) || opts[:severity].is_a?(Symbol)
  raise 'severity not a recognized value' unless SEVERITY.include? opts[:severity].to_sym

  @severity = opts[:severity].to_sym
  @category = opts[:category]
  @type = opts[:type]
  @title = opts[:title]
  @message = opts[:message]
  @snippet = opts[:snippet]
  @icon = opts[:icon]
  @code = opts[:code]
  @url = opts[:url]
  @detail = opts[:detail]
end

Public Instance Methods

to_json(*args) click to toggle source
# File lib/blinkr/error.rb, line 22
def to_json(*args)
  content = {}
  instance_variables.each do |v|
    content[v.to_s[1..-1]] = instance_variable_get v
  end
  content.to_json
end