Skip to content

Instantly share code, notes, and snippets.

@krishicks
Created September 30, 2011 14:34
Show Gist options
  • Save krishicks/1253926 to your computer and use it in GitHub Desktop.
Save krishicks/1253926 to your computer and use it in GitHub Desktop.
active_support_inflector => ActiveSupport::Inflector
require 'active_support/inflector'
constantize = lambda { |str|
result = ""
str.split("_").inject("") { |acc, klass|
begin
try = acc + klass.classify
try.constantize
result = try
try + "::"
rescue NameError
try
end
}
result.constantize
}
constantize["active_support_inflector"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment