Class: Blinkr::Error
- Inherits:
-
Object
- Object
- Blinkr::Error
- Defined in:
- lib/blinkr/error.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#snippet ⇒ Object
readonly
Returns the value of attribute snippet.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Error
constructor
A new instance of Error.
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Error
Returns a new instance of Error.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 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] @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 |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
4 5 6 |
# File 'lib/blinkr/error.rb', line 4 def category @category end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/blinkr/error.rb', line 4 def code @code end |
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
4 5 6 |
# File 'lib/blinkr/error.rb', line 4 def detail @detail end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
4 5 6 |
# File 'lib/blinkr/error.rb', line 4 def icon @icon end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/blinkr/error.rb', line 4 def @message end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
4 5 6 |
# File 'lib/blinkr/error.rb', line 4 def severity @severity end |
#snippet ⇒ Object (readonly)
Returns the value of attribute snippet.
4 5 6 |
# File 'lib/blinkr/error.rb', line 4 def snippet @snippet end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/blinkr/error.rb', line 4 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/blinkr/error.rb', line 4 def type @type end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/blinkr/error.rb', line 4 def url @url end |
Instance Method Details
#to_json(*args) ⇒ Object
22 23 24 25 26 27 28 |
# 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 |