开发者

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/th开发者_JAVA技巧illaiselvan/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,


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜