module Thor::Util

def self.namespace_from_thor_class(constant, remove_default=true)


String:: If we receive Foo::Bar::Baz it returns "foo:bar:baz"
==== Returns

constant:: The constant to be converted to the thor path.
==== Parameters

namespace from a class, just call namespace on it.
older versions of Thor. On current versions, if you need to get the
This method should not be used in general because it's used to deal with

the sandbox namespace.
can be added to a sandbox, this method is also responsable for removing
Receives a constant and converts it to a Thor namespace. Since Thor tasks
def self.namespace_from_thor_class(constant, remove_default=true)
  constant = constant.to_s.gsub(/^Thor::Sandbox::/, "")
  constant = snake_case(constant).squeeze(":")
  constant.gsub!(/^default/, '') if remove_default
  constant
end