Module: CommandKit::CommandName::ClassMethods

Defined in:
lib/command_kit/command_name.rb

Overview

Defines class-level methods.

Instance Method Summary collapse

Instance Method Details

#command_name(new_command_name = nil) ⇒ String

Derives the command name from the class name.

Parameters:

  • new_command_name (String, nil) (defaults to: nil)

    If given a command name argument, it will override the derived command name.

Returns:

  • (String)


75
76
77
78
79
80
81
# File 'lib/command_kit/command_name.rb', line 75

def command_name(new_command_name=nil)
  if new_command_name
    @command_name = new_command_name.to_s
  else
    @command_name || Inflector.underscore(Inflector.demodularize(name))
  end
end