Finding the files that make up a Ruby class -


in ruby, there way determine files loaded , defined/modified particular class?

i don't think there's easy way correctly, approximation in 1.9 find source_location methods in class:

class class   def source_files     methods.collect { |method_name|       method(method_name).source_location[0] # filename, not line number     } |     instance_methods.collect { |method_name|       instance_method(method_name).source_location[0]     }   end end 

this give files defining methods inherited superclass or included modules, i'm not sure whether want. there ways modify class besides defining methods in it, doesn't detect them, it's not perfect.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -