Invoke the given namespace or class given. It adds an instance method that
will invoke the klass
and command. You can give a block to configure how it will be invoked.
The namespace/class given will have its options showed on the help usage. Checkinvoke_from_option
for more information.
# File lib/bundler/vendor/thor/lib/thor/group.rb, line 56
def invoke(*names, &block)
options = names.last.is_a?(Hash) ? names.pop : {}
verbose = options.fetch(:verbose, true)
names.each do |name|
invocations[name] = false
invocation_blocks[name] = block if block_given?
class_eval def _invoke_#{name.to_s.gsub(/\W/, '_')} klass, command = self.class.prepare_for_invocation(nil, #{name.inspect}) if klass say_status :invoke, #{name.inspect}, #{verbose.inspect} block = self.class.invocation_blocks[#{name.inspect}] _invoke_for_class_method klass, command, &block else say_status :error, %(#{name.inspect} [not found]), :red end end, __FILE__, __LINE__
end
end