Sha256: 82307ca5bdd2f1b48952d23fdb542d43b22c135015b1b9cc51d4648d5bbc8d0d
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
module Spackle::Output # This is the foundation of all Spackle::Output classes, but by itself # it does nothing. # # Using an Output class should be simple: # (assuming errors is an Array of Spackle::Error objects) # puts Spackle::Output::VimQuickfix.format(errors) # # The child class (VimQuickfix) only needs to implement the # format_backtrace instance method. # # Spackle::Output::Base is responsible for things like: # * iterating over the backtrace collection # * making pathnames relative # * limiting the number of errors that are output # * filtering the backtrace output by filename # # Spackle::Output::Base interacts with Spackle's Configuration # # If you're writing your own Output class, it should be quite # easy to override some of the Configuration handling if your # class requires it. # class Base attr_accessor :error def initialize(error = nil) self.error = error || Spackle.current_error end def formatted_lines error.backtrace.map do |bt| format_backtrace_line error.message, bt.file, bt.line end end def format formatted_lines.join("\n") + "\n" end def self.format(error = nil) new(error || Spackle.current_error).format end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spackle-0.0.3 | lib/spackle/output/base.rb |
spackle-0.0.2 | lib/spackle/output/base.rb |
spackle-0.0.1 | lib/spackle/output/base.rb |