Skip to content

Instantly share code, notes, and snippets.

@engineyard
Created July 24, 2008 02:31
Show Gist options
  • Save engineyard/2010 to your computer and use it in GitHub Desktop.
Save engineyard/2010 to your computer and use it in GitHub Desktop.
Exists:
Foo
Foo::Bar
Foo::Bar::Baz
Foo::Baz::Bat
Foo::Baz::Bat::Bam
Examples:
Foo.full_const_get("Bar") #=> Foo::Bar
Foo::Baz.full_const_get("Bar::Baz") #=> Foo::Bar::Baz
Foo::Baz::Bat.full_const_get("Bar::Baz") #=> Foo::Bar::Baz
Algorithm:
do regular const_get, then do the rigid const_get from Merb. Failing that, try to do the rigid const_get for the first two, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment