Last active
December 28, 2015 22:28
-
-
Save jamesmccann-zz/7571406 to your computer and use it in GitHub Desktop.
Find all unique instance variable declarations in a Ruby Module
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
seen_variables = [] | |
File.open(ARGV[0], 'r').each do |line| | |
line = line.strip! | |
/^@\w+/.match(line) do |v| | |
puts v unless seen_variables.include?(v.to_s) | |
seen_variables << v.to_s | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment