Skip to content

Instantly share code, notes, and snippets.

@jeffreybaird
Created August 8, 2012 14:14
Show Gist options
  • Select an option

  • Save jeffreybaird/3295351 to your computer and use it in GitHub Desktop.

Select an option

Save jeffreybaird/3295351 to your computer and use it in GitHub Desktop.
Find out which classes are called most often (stolen from gary bearnhart)
grep -rh '^[[:space:]]*\(class\|module\)\b' app lib --include='*.rb' |
sed 's/^[[:space:]]*//' |
cut -d ' ' -f 2 |
while read class; do
echo "`grep -rl "\b$class\b" app lib --include="*.rb" | wc -l` $class";
done |
sort -n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment