Let’s say you want to know what symbols are added when you require something in ruby. For example, I was curious if I could get a list of symbols that were added when I required ‘english’.
I simply used Symbol.all_symbols to save off the old symbol array and the new one and then subtracted the two arrays.
before = Symbol.all_symbols require 'english' after = Symbol.all_symbols added_symbols = after - before p added_symbols # should be an Array of symbols added. puts added_symbols.count # I get 35.
Do you have other favorites?