method
find_class_and_command_by_namespace
v2_6_3 -
Show latest stable
-
0 notes -
Class: Util
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3 (0)
- What's this?
find_class_and_command_by_namespace(namespace, fallback = true)
public
Receives a namespace and tries to retrieve a Bundler::Thor or Bundler::Thor::Group class from it. It first searches for a class using the all the given namespace, if it’s not found, removes the highest entry and searches for the class again. If found, returns the highest entry as the class name.
Examples
class Foo::Bar < Bundler::Thor def baz end end class Baz::Foo < Bundler::Thor::Group end Bundler::Thor::Util.namespace_to_thor_class("foo:bar") #=> Foo::Bar, nil # will invoke default command Bundler::Thor::Util.namespace_to_thor_class("baz:foo") #=> Baz::Foo, nil Bundler::Thor::Util.namespace_to_thor_class("foo:bar:baz") #=> Foo::Bar, "baz"