From: "Jesús Gabriel y Galán" Date: 2011-07-28T02:37:38+09:00 Subject: Re: Counting lines of code in a ruby code file ignoring method code lines in the process On Wed, Jul 27, 2011 at 6:40 PM, Harry Truax wrote: > Thanks for the reply Peter. Yeah, I thought about something like that, but > there could be a method where the end is on the same line as the > corresponding statement, like > > def do_this (y) x = y + 10 end > > or inside the method like > > if (x < y) x = y end > > I also thought about looking for a code line that started with 'end' and > using that to conclude that the method was finished, but someone could have > mistakenly typed a space char in fron t of it when writing it. > > Appreciate your help! Maybe you could take a look at ruby_parser or parse_tree. I currently don't know how to implement your requirement with them, but I guess it should be possible. Jesus.