Class: Line
Overview
TODO: Pick a backtrace format. (Also, add a method to replace default backtracer.) TODO: This chould be in a class.
Instance Attribute Summary collapse
-
#dir ⇒ Object
:nodoc:.
-
#filename ⇒ Object
:nodoc:.
-
#meth ⇒ Object
:nodoc:.
-
#num ⇒ Object
:nodoc:.
-
#path ⇒ Object
:nodoc:.
Instance Method Summary collapse
- #codeline ⇒ Object
- #gem? ⇒ Boolean
-
#initialize(path, num, meth) ⇒ Line
constructor
A new instance of Line.
Constructor Details
#initialize(path, num, meth) ⇒ Line
Returns a new instance of Line.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/epitools/pretty_backtrace.rb', line 10 def initialize(path, num, meth) @path = path @num = num @meth = meth @gem = false @dir, @filename = File.split(path) if @dir =~ %r{^/usr/lib/ruby/gems/1.8/gems/(.+)} @dir = "[gem] #{$1}" @gem = true end end |
Instance Attribute Details
#filename ⇒ Object
:nodoc:
8 9 10 |
# File 'lib/epitools/pretty_backtrace.rb', line 8 def filename @filename end |
Instance Method Details
#codeline ⇒ Object
30 31 32 33 |
# File 'lib/epitools/pretty_backtrace.rb', line 30 def codeline l = @num.to_i - 1 open(path).readlines[l] end |
#gem? ⇒ Boolean
26 27 28 |
# File 'lib/epitools/pretty_backtrace.rb', line 26 def gem? @gem end |