Created
November 8, 2012 16:51
-
-
Save aaron/4040018 to your computer and use it in GitHub Desktop.
List duplicate rails helper methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h = Hash.new(0) | |
Dir.glob(Rails.root.join('app','helpers','*.rb')).each do |file| | |
File.read(file).lines.each do |line| | |
if line[/^[ ]+def ([a-zA-Z0-9!_]+)/] | |
h[$1] += 1 | |
end | |
end | |
end | |
h.each {|key, value| puts key if value > 1} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment