Created
June 10, 2016 23:47
-
-
Save zev/1813c1f88d1a07ec6fe6a48a3dc88ba7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
begin | |
class_to_load = class_name.constantize | |
class_to_load.new | |
# ... | |
rescue NameError => e | |
# do other things if class_name is not an actual class | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment