Created
November 7, 2012 13:11
-
-
Save zakky-dev/4031510 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 Object.const_missing(name) | |
replaced_string = name.to_s.gsub(/([A-Z]+)/, '/\1').downcase | |
require File.expand_path(File.dirname(__FILE__) + replaced_string + '.rb') | |
raise "Const missing." unless const_defined? name | |
const_get(name.to_s) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment