Class: Spackle::Error
- Inherits:
-
Object
- Object
- Spackle::Error
- Defined in:
- lib/spackle/error.rb
Instance Attribute Summary collapse
-
#backtrace ⇒ Object
readonly
Returns the value of attribute backtrace.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #add_error(error_or_file, line = nil) ⇒ Object
-
#initialize(message) {|_self| ... } ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message) {|_self| ... } ⇒ Error
Returns a new instance of Error.
12 13 14 15 16 |
# File 'lib/spackle/error.rb', line 12 def initialize() @message = @backtrace = [] yield self if block_given? end |
Instance Attribute Details
#backtrace ⇒ Object (readonly)
Returns the value of attribute backtrace.
10 11 12 |
# File 'lib/spackle/error.rb', line 10 def backtrace @backtrace end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
10 11 12 |
# File 'lib/spackle/error.rb', line 10 def @message end |
Instance Method Details
#add_error(error_or_file, line = nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/spackle/error.rb', line 18 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 |