class StandardError
Attributes
attributes[RW]
short_message[RW]
Public Class Methods
new(short_message = 'unspecified ugh', **attributes)
click to toggle source
Calls superclass method
# File lib/ugh.rb, line 2 def initialize short_message = 'unspecified ugh', **attributes super short_message @short_message = short_message @attributes = attributes return end
Public Instance Methods
[](name)
click to toggle source
# File lib/ugh.rb, line 33 def [] name return @attributes[name.to_sym] end
[]=(name, value)
click to toggle source
# File lib/ugh.rb, line 37 def []= name, value return @attributes[name.to_sym] = value end
inspect()
click to toggle source
# File lib/ugh.rb, line 29 def inspect return '#<' + to_s(attributes_in_parentheses: false) + '>' end
to_s(attributes_in_parentheses: true)
click to toggle source
# File lib/ugh.rb, line 12 def to_s attributes_in_parentheses: true s = '' << @short_message firstp = true @attributes.each_pair do |name, value| if firstp then s << (attributes_in_parentheses ? ' (' : ', ') firstp = false else s << ', ' end firstp = false s << name.to_s << ': ' << value.inspect end s << ')' if attributes_in_parentheses and !firstp return s end