Created
January 31, 2019 02:10
-
-
Save D-system/38dd1e736e80560811cc03ab75eafbd2 to your computer and use it in GitHub Desktop.
[Ruby exceptions list] List all exceptions available (including the main namespace)
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
exceptions = [] | |
ObjectSpace.each_object(Class) do |k| | |
exceptions << k if k.ancestors.include?(Exception) | |
end | |
puts exceptions.sort { |a,b| a.to_s <=> b.to_s }.join("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment