Created
September 10, 2012 23:22
-
-
Save mcgain/3694734 to your computer and use it in GitHub Desktop.
Ruby create class method
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
| def create_class(class_name, superclass, &block) | |
| klass = Class.new superclass, &block | |
| Object.const_set class_name.to_s, klass | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment