File directory ugly

Check this:

$ cat spec/lib/plugins/filedirbug.rb
puts File.dirname(FILE)
eval(“puts File.dirname(FILE)”)

$ ruby spec/lib/plugins/filedirbug.rb
spec/lib/plugins
.

On Thu, Jul 23, 2009 at 7:30 PM, James A. Bowery[email protected]
wrote:

Check this:

$ cat spec/lib/plugins/filedirbug.rb
puts File.dirname(FILE)
eval(“puts File.dirname(FILE)”)

$ ruby spec/lib/plugins/filedirbug.rb
spec/lib/plugins
.

C:>cat test
eval(“puts FILE”)
eval(“puts File.dirname(FILE)”)

eval(“puts LINE”)

C:>ruby test
(eval)
.
1

.

If you look at the source for eval, you’ll see:

char *file = "(eval)";
int line = 1;

http://www.ruby-doc.org/core/classes/Kernel.src/M005922.html

Gordon

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs