Method: Thor::Group#_invoke_for_class_method

Defined in:
lib/thor/group.rb

#_invoke_for_class_method(klass, command = nil, *args, &block) ⇒ Object (protected)

Shortcut to invoke with padding and block handling. Use internally by invoke and invoke_from_option class methods.



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/thor/group.rb', line 270

def _invoke_for_class_method(klass, command = nil, *args, &block) #:nodoc:
  with_padding do
    if block
      case block.arity
      when 3
        yield(self, klass, command)
      when 2
        yield(self, klass)
      when 1
        instance_exec(klass, &block)
      end
    else
      invoke klass, command, *args
    end
  end
end