Module: CommandKit::Usage::ClassMethods

Defined in:
lib/command_kit/usage.rb

Overview

Class-level methods.

Instance Method Summary collapse

Instance Method Details

#usage(new_usage = nil) ⇒ String+

Gets or sets the class'es usage string(s).

Examples:

usage "[options] ARG1 ARG2 [ARG3 ...]"

Parameters:

  • new_usage (String, Array<String>, nil) (defaults to: nil)

    If a new_usage argument is given, it will set the class'es usage string(s).

Returns:

  • (String, Array<String>)

    The class'es or superclass'es usage string(s).



63
64
65
66
67
68
69
# File 'lib/command_kit/usage.rb', line 63

def usage(new_usage=nil)
  if new_usage
    @usage = new_usage
  else
    @usage || (superclass.usage if superclass.kind_of?(ClassMethods))
  end
end