Created
April 15, 2009 15:23
-
-
Save jm/95842 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
| def create_from_string(klass, string = "") | |
| # like calling String.new or something because | |
| # klass is a variable representing the class you passed in | |
| klass.new(string) | |
| end | |
| x = create_from_string(String, "dude") | |
| y = create_from_string(Regexp, "wat") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment