Exception: Ditto::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Ditto::Error
- Defined in:
- lib/ditto/error.rb
Instance Attribute Summary collapse
-
#src ⇒ Object
readonly
Returns the value of attribute src.
Instance Method Summary collapse
-
#initialize(src = nil) ⇒ Error
constructor
A new instance of Error.
- #message(debug = false) ⇒ Object
- #source(debug = false) ⇒ Object
Constructor Details
#initialize(src = nil) ⇒ Error
Returns a new instance of Error.
4 5 6 |
# File 'lib/ditto/error.rb', line 4 def initialize(src = nil) @src = src end |
Instance Attribute Details
#src ⇒ Object (readonly)
Returns the value of attribute src.
3 4 5 |
# File 'lib/ditto/error.rb', line 3 def src @src end |
Instance Method Details
#message(debug = false) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/ditto/error.rb', line 12 def debug=false msg = "#{to_s}" msg += " at #{source(debug)}" unless src.nil? msg += "\n#{backtrace.join("\n")}" if debug return msg end |
#source(debug = false) ⇒ Object
7 8 9 10 11 |
# File 'lib/ditto/error.rb', line 7 def source debug=false return "n/a" if @src.nil? or @src[0].nil? or @src[1].nil? @src[0] = File.basename(@src[0]) unless debug "#{@src[0]}:#{@src[1]}" end |