>>>George Moschovitis wrote: >>> My class is defined in one file only. I dont want a general solution. I >>> want a solution for classes defined in a single file. Any other ideas? I dont' know what kind of performance you are looking for, but if you know the file: classes = {} File.open( "file.rb" ) do |file| file.each_line do |line| next unless line =~ /\s*class\s*(\w+)/ classes[ $1 ] = file.lineno end end puts "I found the class MyClass in file file.rb at line #{classes['MyClass']}" This will build a hash of your class to lineno found in the source "file.rb". the "file.rb" could also be replaced with just saying __FILE__ if you are wanting to parse the currently loaded file. This could easily be expanded to suit any need, but granted it reparses your source files and thus is slower and less efficient, Zach