spec/test_projects/one_file_project/analyzer.rb
#Counts lines of code in a method
#
#@param method_name [String] the name of the method
#@return [Integer] lines of code count
Counts lines of code in a method
Counts lines of code in a method
def count_lines_in_method(method_name)
      flag = false
      lines = []
      File.foreach(@current_path) do |line|
        break if line =~ /def/ && flag
        lines << line if flag && line.strip != '' && line.strip[0] != '#'
        flag = true if line =~ /def #{method_name}/
      end
      lines.size
    end
def count_lines_in_method ( method_name ) flag = false lines = [ ] File . foreach ( @current_path ) do | line | break if line =~ / def / && flag lines << line if flag && line . strip != '' && line . strip [ 0 ] != '#' flag = true if line =~ / def  #{ method_name } / end lines . size end
Counts lines of code in a method
Counts lines of code in a method
lines of code count
lines of code count
Integer
method_name
the name of the method
the name of the method