lib/reconn/analyzer.rb
def count_lines_in_method(method_name)
      method_name = method_name.gsub(/[\.\|\(\)\[\]\{\}\+\\\^\$\*\?]/) {|match| '\\' + match}
      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}/ || line =~ /def self.#{method_name}/
      end

      lines.size
    end
#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)
      method_name = method_name.gsub(/[\.\|\(\)\[\]\{\}\+\\\^\$\*\?]/) {|match| '\\' + match}
      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}/ || line =~ /def self.#{method_name}/
      end
      lines.size
    end
def count_lines_in_method ( method_name ) method_name = method_name . gsub ( / [ \. \| \( \) \[ \] \{ \} \+ \\ \^ \$ \* \? ] / ) { | match | '\\' + match } 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 } / || line =~ / def self. #{ 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