Determining source of a file

Hey All,

Hopefully this isn’t the most complex question in the world…

How can you determine the source file that a Class is using?

For example, I’d like to find the source file on my hard drive that is supporting the class Feed in the below example.

Feedzirra::Feed.location_to_source_implementation

Does anyone know the syntax for this?

Thanks,
Jim

Hey All,

Hopefully this isn’t the most complex question in the world…

How can you determine the source file that a Class is using?

For example, I’d like to find the source file on my hard drive that is supporting the class Feed in the below example.

Feedzirra::Feed.location_to_source_implementation

Does anyone know the syntax for this?

Thanks,
Jim

Jim, what are you trying to do exactly?

-Conrad

I’m debugging an issue and I’d like to rule out the possibility that my system is pulling a particular library from an incorrect location.

-Jim

Jim, are you talking about an installed Ruby gem/plugin? Or something that you have implemented as a part of your application?

-Conrad

Installed ruby gem or plugin.

Thanks,
Jim

Hi -

Hey All,

Hopefully this isn't the most complex question in the world...

How can you determine the source file that a Class is using?

For example, I'd like to find the source file on my hard drive that is supporting the class Feed in the below example.

Feedzirra::Feed.location_to_source_implementation

Does anyone know the syntax for this?

AFAIK there's no *simple* syntax for this.
If you need to know your environment better you can try a Gem.default_path and join, but it seems like it won't be enough.
If I had to go through all this pain (and I'd sure try to avoid it as much as possible) I would use SCRIPT_LINES___

SCRIPT_LINES__ = { }
require 'net/http'
p SCRIPT_LINES__

Good luck :stuck_out_tongue:
  ngw