Getting `__FILE__` from `self.class`

Hello all,

I’m wondering if there is a way to extract the __FILE__ value from self.class. My intention is to eventually look in the parent directories for a configuration YAML.

The class that needs to access the path is defined, then later on another class uses it as its parent (example Parent < Child). From the Parent class I’m attempting to retrieve __FILE__ of the Child class. Is it possible to do this without going about self.class.method(:new).source_location?

Thanks!

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