How to get the full file path of an arbitrary ruby class?
Posted
by Travis
on Stack Overflow
See other posts from Stack Overflow
or by Travis
Published on 2010-05-09T01:27:14Z
Indexed on
2010/05/09
1:38 UTC
Read the original article
Hit count: 209
ruby
eg:
class Base
def self.inherited(subclass)
puts "New subclass: #{subclass}"
path_of_subclass = ????
end
end
Then in another file/class, it extends Base.
class X < Base
....
end
How would I get the path to the rb file of that subclass from the super class.
© Stack Overflow or respective owner