Module: CommandKit::CommandName
- Extended by:
- ModuleMethods
- Defined in:
- lib/command_kit/command_name.rb
Overview
Defines or derives a command class'es command-name.
Examples
Implicit
class MyCmd
include CommandKit::CommandName
end
MyCmd.command_name
# => "my_cmd"
Explicit
class MyCmd
include CommandKit::CommandName
commnad_name 'foo-cmd'
end
MyCmd.command_name
# => "foo-cmd"
Defined Under Namespace
Modules: ClassMethods, ModuleMethods
Instance Attribute Summary collapse
-
#command_name ⇒ String
readonly
The commands name.
Instance Method Summary collapse
-
#initialize(command_name: self.class.command_name, **kwargs) ⇒ Object
Initializes command_name.
Methods included from ModuleMethods
Instance Attribute Details
#command_name ⇒ String (readonly)
The commands name.
89 90 91 |
# File 'lib/command_kit/command_name.rb', line 89 def command_name @command_name end |
Instance Method Details
#initialize(command_name: self.class.command_name, **kwargs) ⇒ Object
Initializes command_name.
100 101 102 103 104 |
# File 'lib/command_kit/command_name.rb', line 100 def initialize(command_name: self.class.command_name, **kwargs) @command_name = command_name super(**kwargs) end |