Search code examples
ruby-on-railsrubyctagsexuberant-ctags

How do I find the line number in which the function is ending in Ruby file?



Generally by using the ctags -x <file_name.rb> this command will give the line numbers in which each functions in that ruby file starts.

Example:

ctags -x /home/thillaiselvan/selva/Engg/CVS_Admin/CVS_TEST/src/application_helper.rb

Sample output:

select_user      method      604 /home/thillaiselvan/selva/Engg/CVS_Admin/CVS_TEST/src/application_helper.rb def select_user( name = 'user' , field = 'id' )

So from the output I can understand that in application_helper.rb file in line number 604 the select_user function is starting.

My requirement is, is there any way to find the line number in which each functions ends. Please help. Thanks in advance,


Solution

  • exuberant-ctags and other ctags software I know of don't have this feature. You may want to implement it yourself in Ruby, by taking a Ruby tokenizer/parser, and finding the end corresponding to the def found in the line emitted by ctags.