Skip to content

Instantly share code, notes, and snippets.

@unakatsuo
Last active December 19, 2015 20:59
Show Gist options
  • Save unakatsuo/6017372 to your computer and use it in GitHub Desktop.
Save unakatsuo/6017372 to your computer and use it in GitHub Desktop.
Onliner for constantize from string.
module A
module B
module C
end
end
end
'A::B::C'.split('::').unshift(Object).inject{|l, o| l.const_get(o) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment