On 27 Aug 2007, at 13:45, Aaron S. wrote:
self.filepath = $0
See what i’m going for? Any ideas on how to get away with this?
Do you want the name of the file each object is defined in? I think
you want FILE instead of $0 in that case since $0 is always the
top level Ruby program.
Also there is no superclass for Object so super#initialize won’t work
I think. This maybe gets closer - but still doesn’t actually work:
[[email protected]]/Users/alexg/Desktop(55): cat main.rb
f = Foo.new
[[email protected]]/Users/alexg/Desktop(56): cat foo.rb
[[email protected]]/Users/alexg/Desktop(57): cat filepath.rb
alias :old_new :new
result = old_new(*args)
result.filepath = FILE
[[email protected]]/Users/alexg/Desktop(58): ruby main.rb
We would of course like it to output ‘foo.rb’ if I understand you right.