[MacRuby-devel] Kernel#caller doesn't show directories

Brian Marick marick at exampler.com
Mon May 3 13:12:23 PDT 2010


I see that this works in 0.7. Sorry for the waste of bandwidth.

On May 3, 2010, at 11:27 AM, Brian Marick wrote:

> Suppose you have foo.rb:
> 
>  def __DIR__
>    caller[0]
>    raise 'death'
>  end
> 
>  puts __DIR__
> 
> 
> If you call that from, say, a directory two levels below it, you get this:
> 
> 818 $ macruby ../../foo.rb
> foo.rb:2:in `__DIR__': death (RuntimeError)
> 	from foo.rb:6:in `<main>'
> 
> In 1.8.6 (and I sure hope in stock 1.9), you get filenames with the relative directory:
> 
> 819 $ ruby ../../foo.rb
> ../../foo.rb:3:in `__DIR__': death (RuntimeError)
> 	from ../../foo.rb:6
> 
> I think that's important because there are tools (IDEs, my emacs hacks) that use the backtrace from a test to jump to the failing code. You can't do that unless you have the full pathname.
> 
> I will file a ticket if this is a real bug.
> 
> 
> -----
> Brian Marick, independent consultant
> Mostly on agile methods with a testing slant
> Author of /Programming Cocoa with Ruby/
> www.exampler.com, www.exampler.com/blog, www.twitter.com/marick
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



-----
Brian Marick, independent consultant
Mostly on agile methods with a testing slant
Author of /Programming Cocoa with Ruby/
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick



More information about the MacRuby-devel mailing list