Indents text a given number of spaces.
# File lib/rescuers/base.rb, line 24 def indent(lines, spaces = 25) lines.map { |line| (" " * spaces) + line }.join("\n") end
Logs an exception.
# File lib/rescuers/base.rb, line 11 def log(exception) return if @logger.nil? klass = exception.class.name # We can omit the message if it's identical to the class name. message = exception.message unless exception.message == klass # Indent the exception so it stands apart from the rest of the messages. backtrace = indent(exception.backtrace) @logger.debug("Rescuer") { "rescued: #{klass}#{": #{message}" if message}\n#{backtrace}" } end
Generated with the Darkfish Rdoc Generator 2.