Sha256: 15fd749b0edeedabf0f4eee37d4663b868f9b66c273c7c043f24d22cf17c5676
Contents?: true
Size: 1.28 KB
Versions: 8
Compression:
Stored size: 1.28 KB
Contents
module CommandKit # # Defines a place-holder {Help#help help} method. # # ## Examples # # class MyCmd # include CommandKit::Help # # def help # puts "..." # end # end # # MyCmd.help # module Help # # @api private # module ModuleMethods # # Extends {ClassMethods} or {ModuleMethods}, depending on whether {Help} # is being included into a class or a module. # # @param [Class, Module] context # The class or module which is extending {ClassMethods}. # def included(context) super(context) if context.class == Module context.extend ModuleMethods else context.extend ClassMethods end end end extend ModuleMethods # # Class-level methods. # module ClassMethods # # Prints `--help` information. # # @param [Hash{Symbol => Object}] kwargs # Additional keyword arguments for `#initialize`. # # @see Help#help # # @api public # def help(**kwargs) new(**kwargs).help end end # # Prints `--help` information. # # @abstract # # @api public # def help end end end
Version data entries
8 entries across 8 versions & 1 rubygems