Skip to content

Instantly share code, notes, and snippets.

@jamesmccann-zz
Last active December 28, 2015 22:28
Show Gist options
  • Save jamesmccann-zz/7571406 to your computer and use it in GitHub Desktop.
Save jamesmccann-zz/7571406 to your computer and use it in GitHub Desktop.
Find all unique instance variable declarations in a Ruby Module
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