Skip to content

Instantly share code, notes, and snippets.

@D-system
Created January 31, 2019 02:10
Show Gist options
  • Save D-system/38dd1e736e80560811cc03ab75eafbd2 to your computer and use it in GitHub Desktop.
Save D-system/38dd1e736e80560811cc03ab75eafbd2 to your computer and use it in GitHub Desktop.
[Ruby exceptions list] List all exceptions available (including the main namespace)
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