Skip to content

Instantly share code, notes, and snippets.

@arathunku
Last active February 6, 2018 15:21
Show Gist options
  • Save arathunku/5ce5ad8ebab30bd3b9ad4fcdd29c7582 to your computer and use it in GitHub Desktop.
Save arathunku/5ce5ad8ebab30bd3b9ad4fcdd29c7582 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
file_with_methods="${1?Pass filename}"
# set -e
(
IFS='
'
for line in `rg "def (\w+)" ${file_with_methods} -r '\$1' -o --no-line-number`; do
COUNT="$(rg $line -F . | wc -l)"
if test $COUNT -gt 1; then
echo "${line} used ${COUNT}"
else
echo "${line} unused"
fi
done
)
@arathunku
Copy link
Author

curl -sSL https://gist.githubusercontent.com/arathunku/5ce5ad8ebab30bd3b9ad4fcdd29c7582/raw/rg-ruby-methods-usage.sh -o rg-ruby-methods-usage.sh && chmod +x rg-ruby-methods-usage.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment