Sha256: df086077c3bcf49d9b5fa1af3cccef571ea0df396d3c88230e7373944b1c5f21

Contents?: true

Size: 531 Bytes

Versions: 1

Compression:

Stored size: 531 Bytes

Contents

require 'syntax_finder'

# Cound up all of method names.

class MethodNameFinder < SyntaxFinder
  def look node
    if node.type == :call_node
      inc [:call, node.name]
      # pp [nloc(node),nlines(node).lines.first.chomp] unless @@opt[:quiet]
    elsif node.type == :def_node
      inc [:def, node.name]
      # pp [nloc(node),nlines(node).lines.first.chomp] unless @@opt[:quiet]
    end
  end

  def self.print_result
    @@result.sort_by{|(t, m), v| [t, -v]}.each{|(t, m), v|
      puts "#{v}\t#{t}\t#{m}" 
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
syntax_finder-0.1.0 samples/all_method_name_finder.rb