Sha256: 19a4e451c9380c04944bb19b34f7da7cf167002fc11775800497af8871843371
Contents?: true
Size: 688 Bytes
Versions: 3
Compression:
Stored size: 688 Bytes
Contents
module Spackle class BacktraceEntry attr_reader :file, :line def initialize(file, line) @file, @line = file, line end end class Error attr_reader :message, :backtrace def initialize(message) @message = message @backtrace = [] yield self if block_given? end def add_error(error_or_file, line = nil) case error_or_file when Error @backtrace << error_or_file when String @backtrace << BacktraceEntry.new(error_or_file, line) else raise ArgumentError.new("unrecognized error input '#{error_or_file}'. Should be a filename or a Spackle::BacktraceEntry") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spackle-0.0.3 | lib/spackle/error.rb |
spackle-0.0.2 | lib/spackle/error.rb |
spackle-0.0.1 | lib/spackle/error.rb |