Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Gist #5 For "Functional Programming Techniques With Ruby: Part I"
def module_split(module_path, separator = "::")
modules = module_path.split(separator)
modules.length.downto(1).map { |n| modules.first(n).join(separator) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment