class Shippo::Exceptions::Error

Attributes

message[RW]

Public Class Methods

new(thing = nil) click to toggle source
Calls superclass method
# File lib/shippo/exceptions/error.rb, line 7
def initialize(thing = nil)
  if thing.is_a?(String)
    self.message = thing
  elsif thing.respond_to?(:message)
    self.message = thing.message
  else
    super(thing)
  end
end

Public Instance Methods

to_s() click to toggle source
Calls superclass method
# File lib/shippo/exceptions/error.rb, line 21
def to_s
  out = super
  out << " (#{message}) " if message
  to_s_members.each do |member|
    out << member_to_s(member)
  end
  out
end
to_s_members() click to toggle source
# File lib/shippo/exceptions/error.rb, line 17
def to_s_members
  %i()
end

Private Instance Methods

member_to_s(member) click to toggle source
# File lib/shippo/exceptions/error.rb, line 32
def member_to_s(member)
  out   = ''
  value = self.send(member)
  out << "\n#{sprintf('%21s', member)}: '#{value}', " if value && (value != '')
  out
end